logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken....@bmwna.com
Subject RE: Help with loggers - syslogd
Date Mon, 23 Feb 2004 19:25:16 GMT
You're welcome.  BTW, if you're just starting out with log4j, it might be a
good idea to use the XML configuration file format instead of the
properties-based one.  I find it more intuitive to read, and you can't use
filters with the properties-based format.

Ken

> -----Original Message-----
> From: carlos1.rivera@ps.ge.com [mailto:carlos1.rivera@ps.ge.com]
> Sent: Monday, February 23, 2004 2:00 PM
> To: log4j-user@logging.apache.org
> Subject: RE: Help with loggers - syslogd
> 
> 
> Thanks a lot guys.  Works Great!  
> 
> -----Original Message-----
> From: Ken.Liu@bmwna.com [mailto:Ken.Liu@bmwna.com]
> Sent: Monday, February 23, 2004 11:09 AM
> To: log4j-user@logging.apache.org
> Subject: RE: Help with loggers - syslogd
> 
> 
> Hi Carlos -
> 
> Here's what I think you need to do:
> 
> 1) Change:
> 
> > log4j.rootLogger=DEBUG, A1, R, enternetsyslog
> 
> to:
> 
> > log4j.rootLogger=DEBUG, A1, R
> 
> This will remove the enternetsyslog _appender_ from the root 
> log hierarchy.
> This is why you see all the log messages in the syslog.
> 
> 
> 2) Add:
> 
> log4j.logger.enternetsyslog=DEBUG, enternetsyslog
> 
> This creates a new logger called "enternetsyslog" and attaches the
> enternetsyslog appender to it.  You had not specifically attached the
> enternetsyslog appender to an actual logger named 
> enternetsyslog, so logs
> were going to the root logger.
> 
> Give this a try...I think you should be good to go.
> 
> Ken
> 
> > -----Original Message-----
> > From: carlos1.rivera@ps.ge.com [mailto:carlos1.rivera@ps.ge.com]
> > Sent: Saturday, February 21, 2004 2:44 PM
> > To: log4j-user@logging.apache.org
> > Subject: RE: Help with loggers - syslogd
> > 
> > 
> > Sorry for the late post.  Here is my config file:
> > 
> > 
> > 
> > log4j.rootLogger=DEBUG, A1, R, enternetsyslog
> > 
> > log4j.debug=true
> > 
> > log4j.appender.A1=org.apache.log4j.ConsoleAppender
> > log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> > log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
> > log4j.appender.R=org.apache.log4j.RollingFileAppender
> > log4j.appender.R.File=c:\\enternetserver.log
> > log4j.appender.R.MaxFileSize=1024KB
> > log4j.appender.R.MaxBackupIndex=5
> > log4j.appender.R.layout=org.apache.log4j.PatternLayout
> > log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
> > 
> > log4j.logger.com.ge.ClassTest=FATAL
> > 
> > #appender to syslogger
> > log4j.appender.enternetsyslog=org.apache.log4j.net.SyslogAppender
> > log4j.appender.enternetsyslog.SyslogHost=200.200.204.33
> > log4j.appender.enternetsyslog.Facility=LOCAL0
> > log4j.appender.enternetsyslog.FacilityPrinting= 
> > log4j.appender.enternetsyslog.layout=org.apache.log4j.PatternLayout
> > log4j.appender.enternetsyslog.layout.ConversionPattern=%d 
> > [%t] %-5p %c -
> > %m%n
> > 
> > 
> > Basically in my source I have a getLogger with the fully 
> > qualified name of
> > the class where I am invoking the call.  But I can have 
> > another getLogger
> > call with the parameter called "enternetsyslog".  Only those 
> > logs that I
> > invoke with the "enternetsyslog" will go to the syslogd of the host
> > specified the rest goes to the log file.
> > 
> > Thank You again guys.
> > 
> > 
> > -----Original Message-----
> > From: lalitha.prasad_vaka.nonemployee@pfpc.com
> > [mailto:lalitha.prasad_vaka.nonemployee@pfpc.com]
> > Sent: Friday, February 20, 2004 9:21 AM
> > To: Log4J Users List
> > Subject: RE: Help with loggers - syslogd
> > 
> > 
> > 
> > Hey as Ken mentioned would you mind posting ur Config file? 
> > That would help
> > us giving u clear  solution for ur problem.
> > Regards,
> > Lalith
> > 302 791 3363
> > 
> > 
> >  
> > 
> >                       carlos1.rivera@p
> > 
> >                       s.ge.com                 To:
> > log4j-user@logging.apache.org
> > 
> >                                                cc:
> > lalitha.prasad_vaka.nonemployee@pfpc.com
> 
> >                       02/19/2004 02:16         Subject: RE: 
> Help with
> > loggers - syslogd                                                
> >                       PM
> > 
> >                       Please respond
> > 
> >                       to "Log4J Users
> > 
> >                       List"
> > 
> >  
> > 
> >  
> > 
> > 
> > 
> > 
> > Just tried that.  It does not really work.  I tried by having 
> > two instance
> > variables. One that gets the "applicationA" logger and one 
> > that gets the
> > "applicationB" logger.  "applicationA" logger is configured 
> > to use syslog
> > appender.  "applicationB" appender appends to the default 
> > appender that
> > appends to a file.  The issue is that both "applicationA" and
> > "applicationB"
> > loggers logs are going to the syslogd log file.  I just want 
> > "applicationA"
> > logs to go to the syslogd log file.
> > 
> > Any clue on how to do this?
> > 
> > 
> > Thank You
> > -----Original Message-----
> > From: lalitha.prasad_vaka.nonemployee@pfpc.com
> > [mailto:lalitha.prasad_vaka.nonemployee@pfpc.com]
> > Sent: Tuesday, February 17, 2004 5:30 PM
> > To: Log4J Users List
> > Subject: Re: Help with loggers - syslogd
> > 
> > 
> > 
> > Hi,
> > You could use this
> > 
> > log4j.rootLogger=debug, A
> > log4j.logger.applicationA=debug, applicationA
> > log4j.logger.applicationB=debug, applicationB
> > 
> > #### Standard Output
> > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> > log4j.appender.stdout.layout.ConversionPattern==%d [%p] %c %x %m%n
> > 
> > #### R (Root)
> > log4j.appender.A=org.apache.log4j.RollingFileAppender
> > log4j.appender.A.File=root_Log4J.log
> > log4j.appender.A.MaxFileSize=100KB
> > log4j.appender.A.MaxBackupIndex=1
> > log4j.appender.A.layout=org.apache.log4j.PatternLayout
> > log4j.appender.A.layout.ConversionPattern=%d [%p] %c %x %m%n
> > 
> > #### FundServ
> > log4j.appender.applicationA=org.apache.log4j.RollingFileAppender
> > log4j.appender.applicationA.File=FundServ_Log4J.log
> > log4j.appender.applicationA.MaxFileSize=100KB
> > log4j.appender.applicationA.MaxBackupIndex=1
> > log4j.appender.applicationA.layout=org.apache.log4j.PatternLayout
> > log4j.appender.applicationA.layout.ConversionPattern=%d 
> %-5p %l : %m%n
> > 
> > Now you can use
> > 
> > Logger logger1 = Logger.getLogger("applicationA");
> > 
> > 
> > 
> > 
> > 
> > 
> >                       carlos1.rivera@p
> > 
> >                       s.ge.com                 To:
> > log4j-user@jakarta.apache.org
> > 
> >                                                cc:
> > 
>                       02/17/2004 02:08         Subject: Help 
> > with loggers -
> > syslogd
> >                       PM
> > 
> >                       Please respond
> > 
> >                       to "Log4J Users
> > 
> >                       List"
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > I am trying to define a logger that I can use with the syslog 
> > appender.
> > What I want to be able to do is to have a logger that I 
> > obtain by name lets
> > say:
> >              Logger.getLogger("syslogdLogger");
> > How I can define this logger in the configuration file so that when
> > somebody
> > has this logger it logs to the syslogd of a machine?
> > 
> > Thank you
> > 
> > Carlos Javier Rivera Vazquez
> > __________________________________________________
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > -----------------------------------------
> > The contents of this email are the property of PNC. If it was 
> > not addressed
> > to you, you have no legal right to read it. If you think you 
> > received it in
> > error, please notify the sender. Do not forward or copy 
> > without permission
> > of the sender.
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > -----------------------------------------
> > The contents of this email are the property of PNC. If it was 
> > not addressed
> > to you, you have no legal right to read it. If you think you 
> > received it in
> > error, please notify the sender. Do not forward or copy 
> > without permission
> > of the sender.
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message