[prev in list] [next in list] [prev in thread] [next in thread]
List: log4j-user
Subject: Re: Please help (syslog)
From: James Stauffer <stauffer.james () gmail ! com>
Date: 2006-01-11 21:12:25
Message-ID: c83e39890601111312v17350f9bj4e8e4502e2c0b8ea () mail ! gmail ! com
[Download RAW message or body]
I don't use a properties file so I am not positive on how to do it but
I think it would be something like the following:
log4j.rootLogger=INFO, logfile
log4j.logger.notify=INFO, syslog
You will probably want to turn additivity off for the notify logger so
that those logs don't get to the rootLogger (and therefore go to the
logfile appender).
On 1/11/06, Ahmed, Yassir <yahmed@mackenziefinancial.com> wrote:
>
> Thank you James.
>
> Which property can I set to specify which package should go to which logger.
>
> Thank you
>
>
>
>
> log4j.rootLogger=INFO, logfile, syslog
>
> log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.logfile.File=logtest.log
> log4j.appender.logfile.datePattern='.'yyyy-MM-dd
> log4j.appender.logfile.append=true
> log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
> log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - <%m>%n
>
> log4j.appender.syslog = org.apache.log4j.net.SyslogAppender
> log4j.appender.syslog.layout=org..apache.log4j.PatternLayout
> log4j.appender.syslog.SyslogHost=localhost
> log4j.appender.syslog.Facility=KERN
> log4j.appender.syslog.threshold=ERROR
>
>
>
>
>
>
> -----Original Message-----
> From: James Stauffer [mailto:stauffer.james@gmail.com]
> Sent: Tuesday, January 10, 2006 8:35 AM
> To: Ahmed, Yassir; Log4J Users List
> Cc: Yassir Ahmed
> Subject: Re: Please help (syslog)
>
> That actually creates the same logger. You will want to do something like the \
> following. Yes, you can use a properties file to configure the appender.
>
> loggerConsole = Logger.getLogger(LogTest.class);
> //do nothing... by default it will go to File Appender
>
>
> loggerTivoli = Logger.getLogger("notify." + LogTest.class.getName());
>
>
> Then in your properties file send all loggers that start with "notify" to your \
> other appender.
>
>
> On 1/9/06, Ahmed, Yassir <yahmed@mackenziefinancial.com> wrote:
> >
> > Thank you James for the reply.
> >
> > Is this something I can do using property file?
> >
> > Or do I need to do something like this
> >
> > loggerConsole = Logger.getLogger(LogTest.class);
> > //do nothing... by default it will go to File Appender
> >
> >
> > loggerTivoli = Logger.getLogger(LogTest.class);
> > loggerTivoli.addAppender(new SyslogAppender);
> >
> >
> > I tried this but did not work.
> >
> > Would you please explain a little. Any example/reference would be great.
> >
> > Thank you once again...
> >
> > Yassir
> >
> >
> >
> > -----Original Message-----
> > From: Yassir Ahmed [mailto:ahmedyassir@gmail.com]
> > Sent: Monday, January 09, 2006 9:22 AM
> > To: Ahmed, Yassir
> > Subject: Fwd: Please help (syslog)
> >
> >
> >
> >
> > ---------- Forwarded message ----------
> > From: James Stauffer <stauffer.james@gmail.com>
> > Date: Jan 6, 2006 4:32 PM
> > Subject: Re: Please help (syslog)
> > To: Log4J Users List <log4j-user@logging.apache.org>
> >
> > One easy way is to have two hierarchies of loggers and send one to
> > each appender.
> >
> > logger com.product.package.foo is sent to the normal appender
> > logger notify.com.product.package.foo is sent to the syslog appender
> >
> >
> > On 1/6/06, Yassir Ahmed < ahmedyassir@gmail.com> wrote:
> > > I am sorry, I should be more descriptive
> > >
> > > There are some error situations that we want to send to syslog so that
> > > support guys receive email notification. There are some error situations
> > > that will resolve automatically without any support guys involement.
> > >
> > > So I am looking for the best way (and documentation/examples) to do
> > > something like this
> > >
> > > log.error("this error should fix automatically. its ok to ignore it for \
> > > the time being")
> > > log.syslogError("date", "application name", "this error need support guy
> > > involement right away");
> > >
> > > The idea is that log.error(...) will write to only log file and
> > > syslogError(...) will write errors to syslog, Tivoli monitors syslog and \
> > > can detect this error and can send email to support guys.
> > >
> > > log4j documentation discourage overriding Logger class. Even if I \
> > > override it, how can I configure it to get the above described behavious? \
> > > I am confused how to achive this.
> > >
> > > Thank you a lot.
> > >
> > >
> > >
> > >
> > > On 1/6/06, James Stauffer < stauffer.james@gmail.com> wrote:
> > > >
> > > > How do you determine "some" vs. "other"? Are they different \
> > > > loggers?
> > > > On 1/6/06, Yassir Ahmed < ahmedyassir@gmail.com> wrote:
> > > > > Hi all,
> > > > >
> > > > > I want some "warn" and "error" messages to go to log file and other
> > > > "warn"
> > > > > and "error" messages to go to syslog. Any idea how can I do this.
> > > > >
> > > > > Please help.
> > > > >
> > > > > Thank you
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > James Stauffer
> > > > Are you good? Take the test at http://www.livingwaters.com/good/
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > James Stauffer
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >
> >
> > This e-mail and any attachments may contain confidential information. \
> > Any distributing, copying or reliance upon the contents of this e-mail \
> > by anyone other than the intended recipient is strictly prohibited. If \
> > you have received this e-mail accidentally, please delete it and notify \
> > the sender. Although this message has been screened for viruses, we cannot \
> > guarantee that our virus scanner will detect all viruses and take no \
> > responsibility for any damage or loss that may be caused by its \
> > contents.
>
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
>
> This e-mail and any attachments may contain confidential information. Any
> distributing, copying or reliance upon the contents of this e-mail by anyone other
> than the intended recipient is strictly prohibited. If you have received this \
> e-mail accidentally, please delete it and notify the sender. Although this message \
> has been screened for viruses, we cannot guarantee that our virus scanner will \
> detect all viruses and take no responsibility for any damage or loss that may be \
> caused by its contents.
>
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic