Wednesday, 15 June 2011

java - Configuring a class using a logger to log to a file with log4j -



java - Configuring a class using a logger to log to a file with log4j -

hi have 4 classes each share anonymous instances of logger class (not creation). have added log4j appender , set logger log appender file. problem logging file including hibernate. how set classes log file?

here nowadays configuration file:

# direct log messages file log4j.appender.file=com.daniels.logging.rollingfileappender log4j.appender.file.file=daniels.log log4j.appender.file.maxfilesize=100mb log4j.appender.file.maxbackupindex=10 log4j.appender.file.layout=org.apache.log4j.patternlayout log4j.appender.file.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss.s} %-5p [%c{1}:%m] - %m%n log4j.appender.file.append=true # root logger alternative log4j.rootlogger=info, file

one of classes called seriousevent. if class log file com.daniels.logging.rollingfileappender how set up? i'm new logging forgive me. have looked through documentation i'm finding hard getting example.

thanks, daniel

i think links below can help you:

creating multiple log files of different content log4j: link has illustration using more 1 file log , log classes. log4j configuration using properties file

you might see log4j documentation page in order understand appenders.

one question: did develop customized appender system? i'm asking because added on file:

log4j.appender.file=com.daniels.logging.rollingfileappender

seeing on log4j docs, property should , component appender, such as:

log4j.appender.file=org.apache.log4j.rollingfileappender

java logging log4j configuration-files fileappender

No comments:

Post a Comment