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 <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
> *Sent:* Monday, January 09, 2006 9:22 AM
> *To:* Ahmed, Yassir
> *Subject:* Fwd: Please help (syslog)
>
>
>
> ---------- Forwarded message ----------
> From: James Stauffer <[EMAIL PROTECTED]>
> Date: Jan 6, 2006 4:32 PM
> Subject: Re: Please help (syslog)
> To: Log4J Users List <[email protected]>
>
> 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 < [EMAIL PROTECTED]> 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 < [EMAIL PROTECTED]> wrote:
> > >
> > > How do you determine "some" vs. "other"? Are they different loggers?
> > >
> > > On 1/6/06, Yassir Ahmed < [EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> 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/