You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flume.apache.org by mahendran m <ma...@hotmail.com> on 2015/01/10 06:39:08 UTC

logging both to console and log file

Hi ,
Is it possible to use both logging to console with only message as ERROR and logging full information to log file . i have set threshold level to error
sample log4j.properties file like below  

flume.root.logger=INFO,DEBUG,LOGFILEflume.log.dir=/logsflume.log.file=flume.log
log4j.logger.org.apache.flume.lifecycle = INFOlog4j.logger.org.jboss = WARNlog4j.logger.org.mortbay = INFOlog4j.logger.org.apache.avro.ipc.NettyTransceiver = WARNlog4j.logger.org.apache.hadoop = INFO
# Define the root logger to the system property "flume.root.logger".log4j.rootLogger=${flume.root.logger}
# Default log rotation configurationlog4j.appender.LOGFILE=org.apache.log4j.RollingFileAppenderlog4j.appender.LOGFILE.Threshold = ERRORlog4j.appender.LOGFILE.MaxFileSize=1MBlog4j.appender.LOGFILE.MaxBackupIndex=10log4j.appender.LOGFILE.File=${flume.log.dir}/${flume.log.file}log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayoutlog4j.appender.LOGFILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p [%t] (%C.%M:%L) %x - %m%n
# Add "console" to flume.root.logger above if you want to use thislog4j.appender.console=org.apache.log4j.ConsoleAppenderlog4j.appender.console.Threshold = ERRORlog4j.appender.console.target=System.errlog4j.appender.console.layout=org.apache.log4j.PatternLayoutlog4j.appender.console.layout.ConversionPattern=[%p]

for logging to console need only value ERROR no more information so configured as like this log4j.appender.console.layout.ConversionPattern=[%p]

but above configuration not working as i wished. please help.thanks,