You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by David KOCH <dk...@ezakus.com> on 2015/07/27 12:17:16 UTC

Send StatusLogger output to Syslog appender

Hello,

How do I configure log4j2 to send StatusLogger output to a Syslog appender?

Our application runs on several instances and logs to a remote instance for
centralised logging, however status logging only appears in the logs on
each instance.

Thank you,

/David

Re: Send StatusLogger output to Syslog appender

Posted by Ralph Goers <ra...@dslextreme.com>.
StatusLogger was not meant for that kind of flexibility as it is for diagnostics of the logging system.  

While in theory it would be possible to create a StatusListener that binds to an Appender I don’t believe it would be simple. Plus, it couldn’t use Plugins to be configured.  Frankly, it would probably be easier to build a specific StatusListener for a specific Appender that uses the Appender’s Manager.

Ralph

> On Jul 27, 2015, at 10:13 AM, Gary Gregory <ga...@gmail.com> wrote:
> 
> Ralph,
> 
> I fine point I missed, thank you.
> 
> Would it be too weird to provide a bridge StatusListener that forwards to
> an Appender or to all of Log4j?
> 
> Gary
> 
> On Mon, Jul 27, 2015 at 10:09 AM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> 
>> Gary,
>> 
>> This is the StatusLogger. Messages are via StatusListeners. The only one
>> we provide is the StatusConsoleListener.  If a user wants to do something
>> else they need to implement their own StatusListener and register it.
>> 
>> Ralph
>> 
>>> On Jul 27, 2015, at 9:52 AM, Gary Gregory <ga...@gmail.com>
>> wrote:
>>> 
>>> You need to configure log4j: Please see
>>> https://logging.apache.org/log4j/2.x/manual/configuration.html
>>> 
>>> Gary
>>> 
>>> On Mon, Jul 27, 2015 at 3:17 AM, David KOCH <dk...@ezakus.com> wrote:
>>> 
>>>> Hello,
>>>> 
>>>> How do I configure log4j2 to send StatusLogger output to a Syslog
>> appender?
>>>> 
>>>> Our application runs on several instances and logs to a remote instance
>> for
>>>> centralised logging, however status logging only appears in the logs on
>>>> each instance.
>>>> 
>>>> Thank you,
>>>> 
>>>> /David
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory



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


Re: Send StatusLogger output to Syslog appender

Posted by Ralph Goers <ra...@dslextreme.com>.
Using a “regular” logger to log the internals of the logging system is a very bad idea.  I can imagine all kinds of problems, which is why Log4j uses an internal mechanism for status logging.

If the new Configuration contains invalid XML the reconfiguration will fail and the old configuration will remain in effect.

Ralph



> On Jul 27, 2015, at 10:26 AM, David KOCH <dk...@ezakus.com> wrote:
> 
> Hello,
> 
> Thank you for your answers. I gather this is not possible purely by
> configuring log4j2?
> 
> I could implement a ConfigurationListener which logs changed configurations
> to a regular logger but how would that re-act if the new configuration
> contains some invalid XML? The StatusLogger supplies some feedback in that
> cases.
> 
> Regards,
> 
> /David
> 
> On 27 July 2015 at 19:13, Gary Gregory <ga...@gmail.com> wrote:
> 
>> Ralph,
>> 
>> I fine point I missed, thank you.
>> 
>> Would it be too weird to provide a bridge StatusListener that forwards to
>> an Appender or to all of Log4j?
>> 
>> Gary
>> 
>> On Mon, Jul 27, 2015 at 10:09 AM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>> 
>>> Gary,
>>> 
>>> This is the StatusLogger. Messages are via StatusListeners. The only one
>>> we provide is the StatusConsoleListener.  If a user wants to do something
>>> else they need to implement their own StatusListener and register it.
>>> 
>>> Ralph
>>> 
>>>> On Jul 27, 2015, at 9:52 AM, Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>> 
>>>> You need to configure log4j: Please see
>>>> https://logging.apache.org/log4j/2.x/manual/configuration.html
>>>> 
>>>> Gary
>>>> 
>>>> On Mon, Jul 27, 2015 at 3:17 AM, David KOCH <dk...@ezakus.com> wrote:
>>>> 
>>>>> Hello,
>>>>> 
>>>>> How do I configure log4j2 to send StatusLogger output to a Syslog
>>> appender?
>>>>> 
>>>>> Our application runs on several instances and logs to a remote
>> instance
>>> for
>>>>> centralised logging, however status logging only appears in the logs
>> on
>>>>> each instance.
>>>>> 
>>>>> Thank you,
>>>>> 
>>>>> /David
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>> 
>>> 
>> 
>> 
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>> 



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


Re: Send StatusLogger output to Syslog appender

Posted by David KOCH <dk...@ezakus.com>.
Hello,

Thank you for your answers. I gather this is not possible purely by
configuring log4j2?

I could implement a ConfigurationListener which logs changed configurations
to a regular logger but how would that re-act if the new configuration
contains some invalid XML? The StatusLogger supplies some feedback in that
cases.

Regards,

/David

On 27 July 2015 at 19:13, Gary Gregory <ga...@gmail.com> wrote:

> Ralph,
>
> I fine point I missed, thank you.
>
> Would it be too weird to provide a bridge StatusListener that forwards to
> an Appender or to all of Log4j?
>
> Gary
>
> On Mon, Jul 27, 2015 at 10:09 AM, Ralph Goers <ra...@dslextreme.com>
> wrote:
>
> > Gary,
> >
> > This is the StatusLogger. Messages are via StatusListeners. The only one
> > we provide is the StatusConsoleListener.  If a user wants to do something
> > else they need to implement their own StatusListener and register it.
> >
> > Ralph
> >
> > > On Jul 27, 2015, at 9:52 AM, Gary Gregory <ga...@gmail.com>
> > wrote:
> > >
> > > You need to configure log4j: Please see
> > > https://logging.apache.org/log4j/2.x/manual/configuration.html
> > >
> > > Gary
> > >
> > > On Mon, Jul 27, 2015 at 3:17 AM, David KOCH <dk...@ezakus.com> wrote:
> > >
> > >> Hello,
> > >>
> > >> How do I configure log4j2 to send StatusLogger output to a Syslog
> > appender?
> > >>
> > >> Our application runs on several instances and logs to a remote
> instance
> > for
> > >> centralised logging, however status logging only appears in the logs
> on
> > >> each instance.
> > >>
> > >> Thank you,
> > >>
> > >> /David
> > >>
> > >
> > >
> > >
> > > --
> > > E-Mail: garydgregory@gmail.com | ggregory@apache.org
> > > Java Persistence with Hibernate, Second Edition
> > > <http://www.manning.com/bauer3/>
> > > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> > > Spring Batch in Action <http://www.manning.com/templier/>
> > > Blog: http://garygregory.wordpress.com
> > > Home: http://garygregory.com/
> > > Tweet! http://twitter.com/GaryGregory
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>

Re: Send StatusLogger output to Syslog appender

Posted by Gary Gregory <ga...@gmail.com>.
Ralph,

I fine point I missed, thank you.

Would it be too weird to provide a bridge StatusListener that forwards to
an Appender or to all of Log4j?

Gary

On Mon, Jul 27, 2015 at 10:09 AM, Ralph Goers <ra...@dslextreme.com>
wrote:

> Gary,
>
> This is the StatusLogger. Messages are via StatusListeners. The only one
> we provide is the StatusConsoleListener.  If a user wants to do something
> else they need to implement their own StatusListener and register it.
>
> Ralph
>
> > On Jul 27, 2015, at 9:52 AM, Gary Gregory <ga...@gmail.com>
> wrote:
> >
> > You need to configure log4j: Please see
> > https://logging.apache.org/log4j/2.x/manual/configuration.html
> >
> > Gary
> >
> > On Mon, Jul 27, 2015 at 3:17 AM, David KOCH <dk...@ezakus.com> wrote:
> >
> >> Hello,
> >>
> >> How do I configure log4j2 to send StatusLogger output to a Syslog
> appender?
> >>
> >> Our application runs on several instances and logs to a remote instance
> for
> >> centralised logging, however status logging only appears in the logs on
> >> each instance.
> >>
> >> Thank you,
> >>
> >> /David
> >>
> >
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com | ggregory@apache.org
> > Java Persistence with Hibernate, Second Edition
> > <http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> > Spring Batch in Action <http://www.manning.com/templier/>
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: Send StatusLogger output to Syslog appender

Posted by Ralph Goers <ra...@dslextreme.com>.
Gary,

This is the StatusLogger. Messages are via StatusListeners. The only one we provide is the StatusConsoleListener.  If a user wants to do something else they need to implement their own StatusListener and register it.

Ralph

> On Jul 27, 2015, at 9:52 AM, Gary Gregory <ga...@gmail.com> wrote:
> 
> You need to configure log4j: Please see
> https://logging.apache.org/log4j/2.x/manual/configuration.html
> 
> Gary
> 
> On Mon, Jul 27, 2015 at 3:17 AM, David KOCH <dk...@ezakus.com> wrote:
> 
>> Hello,
>> 
>> How do I configure log4j2 to send StatusLogger output to a Syslog appender?
>> 
>> Our application runs on several instances and logs to a remote instance for
>> centralised logging, however status logging only appears in the logs on
>> each instance.
>> 
>> Thank you,
>> 
>> /David
>> 
> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory



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


Re: Send StatusLogger output to Syslog appender

Posted by Gary Gregory <ga...@gmail.com>.
You need to configure log4j: Please see
https://logging.apache.org/log4j/2.x/manual/configuration.html

Gary

On Mon, Jul 27, 2015 at 3:17 AM, David KOCH <dk...@ezakus.com> wrote:

> Hello,
>
> How do I configure log4j2 to send StatusLogger output to a Syslog appender?
>
> Our application runs on several instances and logs to a remote instance for
> centralised logging, however status logging only appears in the logs on
> each instance.
>
> Thank you,
>
> /David
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory