I am trying to set different setting.logpath’s for different environments but it seems like it wants a path variable before the environment variables are set or changed. How can i accomplish different log paths?? Thanks
Override the log paths in the environment overrides. All the structs of data you set up in the configure() method are all available in the config’s variables scope.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
That is what I tried to do but it always just seems to use the default setting for it in the settings struct. I will try again and restart the services. Thanks
It seems to run through the logBox struct before it can use the overrides and always uses the main logPath setting on fwreinit.
Perhaps you can show us your code. Have you seen this:
http://blog.coldbox.org/blog/tip-of-the-week-using-environment-control-in-coldbox
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
I have a bunch of other settings that work OK. Here is the log code that I have. I also tried to put the setting in the coldbox struct instead of settings but had the same result. When I fwreinit it always uses “logs” as the path/folder…
// Custom PMS-ES settings
settings = {
logPath = “logs”
};
environments = {
local = “^127.”,
…
};
//LogBox DSL
logBox = {
appenders = {
coldboxTracer = {class=“coldbox.system.logging.appenders.ConsoleAppender”},
systemLog = {class=“coldbox.system.logging.appenders.RollingFileAppender”,
properties = {fileMaxArchives=30, //Keep last 30 days
filename = “system”,
filePath = settings.logPath,
async=“true”}}
}
// LOCAL
function local(){
settings.logPath = “…/thelogs”;
}
You need to do this in your environment override:
logBox.appenders.systemLog.properties.filePath = ‘overridden path’;
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com