RE: [coldbox:9079] Another bug in ColdBox 3.0 is LogBox

Yeah trust me on this one….

Run your application then delete the logs directory, and re-run your application and sure enough the error occurs.

Regards,

Andrew Scott

http://www.andyscott.id.au/

BTW the error is on this line with the CFFile, it might pay to do a try/catch here and create the dir if it doesn’t exist.

<cffile action=“append”

addnewline=“true”

file="#instance.logFullpath#"

output="#arguments.message#"

charset="#getProperty(“fileEncoding”)#">

Regards,

Andrew Scott

http://www.andyscott.id.au/

I have tried it, and I do not see this behavior?? I copied the appender setup from what you supplied and I get one logs folder created, one directory above webroot, with a log file in it called “SpringField.log”. I did notice, that if I delete this directory. It won’t get recreated automagically for me unless I restart CF. If I delete the log file itself, it is recreated.

Perhaps the log folder it was created was from an old version.

Curt

Curt try this….

With that Appender run your application, it will work. Then delete that directory and run your application, it will fail. Then create a log directory and restart the server, it will then work. And when you look at the directories, you will see you have a log dir and a logs dir…

Regards,

Andrew Scott

http://www.andyscott.id.au/

Oh, I see now, so the bug is that it doesn’t automagically recreate the folder for you. Not the foldername issue with log verses logs like I first thought? Correct.

Curt

See my other post on this Curt. But if I think what your said is what I think, then yes… But double check my post with the exact replication on this.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Well, yes, I have a log directory because I created one, but it is always logging to the correct spot. I do see your point about it producing an error if you delete the directory entirely, but don’t see the two different directory issue at all.

Curt

Curt, then you didn’t place the appender I posted and tried it with that then.

Like I stated, using the log appender that I posted remove the dir log and logs, restart your server then delete the logs directory. It will error, create the log directory it will work, look at your dirs., and you will see both log and logs with the log file actually in the logs dir.

It can’t be any simpler than that.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Here is what I have, copy and pasted from your post for the appenders section…

//LogBox DSL

logBox = {

// Define Appenders

appenders = {

coldboxTracer = {

class=“coldbox.system.logging.appenders.AsyncRollingFileAppender”,

properties={filePath=’…/logs’, fileName=‘SpringField’, autoExpand=true, fileMaxSize=2000, fileMaxArchives=2}

}

},

// Root Logger

root = { levelmax=“INFO”, appenders="*" },

// Implicit Level Categories

info = [ “coldbox.system” ]

};

And I don’t see the issue with log/logs at all. I always only get one directory called logs, one up from webroot as the appender states it should be. Sorry man.

Curt

So you did what I said?

  1. Run your application

  2. Remove the log/logs directory or whatever you call it. Just make sure they are removed.

  3. Rerun your application, error as stated.

If you do this then the error will appear as I stated.

Regards,

Andrew Scott

http://www.andyscott.id.au/

Btw here is the stack trace, it appears to be a wirebox related problem maybe.

The cause of this exception was: java.io.FileNotFoundException: N:/Projects/ColdFusion/dev.andyscott.id.au/logs/SpringField.log (The system cannot find the path specified).

The error occurred inN:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/appenders/FileAppender.cfc: line 189
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/appenders/FileAppender.cfc: line 164
Called fromN:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/appenders/AsyncFileAppender.cfc: line 57
Called fromN:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/appenders/AsyncRollingFileAppender.cfc: line 61
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/Logger.cfc: line 327
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/Logger.cfc: line 267
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/interceptors/Autowire.cfc: line 139
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/interceptors/Autowire.cfc: line 101
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/context/InterceptorState.cfc: line 139
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/context/InterceptorState.cfc: line 86
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/services/InterceptorService.cfc: line 109
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/services/PluginService.cfc: line 123
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/services/PluginService.cfc: line 151
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/Controller.cfc: line 325
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/services/ExceptionService.cfc: line 40
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/Coldbox.cfc: line 156
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/wwwroot/Application.cfc: line 62
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/appenders/FileAppender.cfc: line 189
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/appenders/FileAppender.cfc: line 164
Called fromN:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/appenders/AsyncFileAppender.cfc: line 57
Called fromN:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/appenders/AsyncRollingFileAppender.cfc: line 61
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/Logger.cfc: line 327
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/logging/Logger.cfc: line 267
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/interceptors/Autowire.cfc: line 139
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/interceptors/Autowire.cfc: line 101
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/context/InterceptorState.cfc: line 139
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/context/InterceptorState.cfc: line 86
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/services/InterceptorService.cfc: line 109
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/services/PluginService.cfc: line 123
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/services/PluginService.cfc: line 151
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/Controller.cfc: line 325
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/web/services/ExceptionService.cfc: line 40
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/ColdBox/system/Coldbox.cfc: line 156
Called from N:/Projects/ColdFusion/dev.andyscott.id.au/wwwroot/Application.cfc: line 62

187 : file="#instance.logFullpath#"

188 : output="#arguments.message#"

189 : charset="#getProperty(“fileEncoding”)#">

190 :

191 :

Regards,

Andrew Scott

http://www.andyscott.id.au/