web applications - How to Write Java server logs to separate log file -
After
Right now we are using an optimized logger method for our application, but now we have a stand alone code for which we Need to write for a different log file. We keep very little information about log4j. I just know where to change the properties, if any, so that I know about our logs in the new log file as we The existing logger application in Do not Dist Want as well.
First of all, a file appender is defined:
log4j.appender .LOGFILE = org.apache.log4j.FileAppender log4j.appender.LOGFILE.File = /mylogfile.log log4j.appender.LOGFILE.Append = True log4j.appender.LOGFILE.layout = org.apache.log4j.PatternLayout log4j.appender. LOGFILE.layout.ConversionPattern =% d [% T]% -5p% c% x -% m% n
Then use this appender to point your package:
log4j.logger.mypackage = logfile log4j.additivity.mypackage = false
The last line is important if you do not want your package to be with the global appenders. By doing this mypackage will also result in log messages from the print on the default appender.
Comments
Post a Comment