dcsimg
configuration problem of by programming
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Morisseau_Emmanuel
Posted On:   Monday, May 4, 2009 05:24 PM

Hi I have 2 different appenders.One for de console and other is log4j.appender.file. I have to Configure by programming this is my log4j.properties [CODE] ### direct log messages to stdout ### log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.maxFileSize=100KB log4j.appender.file.maxBackupIndex=5 log4j.appender.file.File=log.text log4j.appender.file.threshold=off log4j.appender.   More>>

Hi I have 2 different appenders.One for de console and other is log4j.appender.file.
I have to Configure by programming
this is my log4j.properties

[CODE]

### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n


log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.maxFileSize=100KB
log4j.appender.file.maxBackupIndex=5
log4j.appender.file.File=log.text
log4j.appender.file.threshold=off
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=warn, stdout,file

log4j.logger.ca.canassistance=debug

[/CODE]

java code
[CODE]
fileAppender.setFile(cheminLogs + "\" + getNomJob() + ".log", true,
true, fileAppender.getBufferSize());
fileAppender.setMaxFileSize(propertiesLog.get("LogFileSize"));
fileAppender.setMaxBackupIndex(Integer.parseInt(propertiesLog
.get("LogFileCount")));
if(!"".equals(propertiesLog.get("nomLogFile")) &&( null!=propertiesLog.get("nomLogFile")))
//Fonctionne pas
[B]fileAppender.setName(propertiesLog.get("nomLogFile"));[/B] //not working [B]Logger.getLogger("file").setLevel(Level.WARN);[/B]

fileAppender.activateOptions();


[/CODE]
This name of the file log doesn t change
and the level is steal info.


Can someOne help me please

   <<Less
About | Sitemap | Contact