Log4j with grails: How to get appender file name at run time?

If your logging configuration is set up like: log4j = { appenders { file name: 'myFileAppender', file: '/tmp/myFile. Log' } debug 'myFileAppender': 'myFileLogger' } You can access the myFileLogger Logger's file name like this: import org.apache. Log4j.

Logger import org.apache. Log4j. FileAppender def appender = (FileAppender)Logger.

GetLogger('myFileLogger'). GetAppender('myFileAppender') def fileName = appender.file.

Excellent. Thanks Rob. – The Fat Oracle Sep 15 '10 at 15:40.

This will find the filename of the first appender: import org.apache. Log4j. * Logger.rootLogger.allAppenders.

Find{it instanceof FileAppender}?.fileName.

I'll try this out. Thanks ataylor. – The Fat Oracle Sep 15 '10 at 15:40.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions