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 Sandeep Dasika <da...@gmail.com> on 2015/07/07 09:01:03 UTC

Query regarding SocketAppender and SimpleSocketServer

Hi log4j team,

I have been using log4j in production systems, and it has delivered us
fantastically. My query is around the SocketAppender and SimpleSocketServer
functionality. We have a group of servers that generate log events. These
are configured to write to file appenders. We also want to have error logs
written to a central log file so that it can be easy to browse to find
potential issues in our product.

I have the natural setup for the remote logging up and running perfectly -
The clients that generate the LoggingEvent objects (our production servers)
all write to a SocketAppender that will send it across to the remote
SimpleSocketServer and that ultimately writes to another file appender,
which gives us the centralised log file to browse. However, since we want
to run it at ERROR level, it would be best for us if we have some client ID
(maybe IP) of the client that sends a particular logging event at the
remote end so that it would be easier for us to pinpoint the problems in
our systems. Seems like I'm not sure how that can be done in log4j. Any
hints/suggestions on this would really help me out!

Thanks in advance.
Cheers!

Re: Query regarding SocketAppender and SimpleSocketServer

Posted by Sandeep Dasika <da...@gmail.com>.
But I want to access the log4j.remoteSourceInfo variable from the log4j
configuration file supplied to the SimpleSocketServer. How can I do that?

Thanks

On Tue, Jul 7, 2015 at 6:34 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> Yes. That property would be in the ThreadContext Map in the log event.
>
> Sent from my iPad
>
> > On Jul 7, 2015, at 5:32 AM, Sandeep Dasika <da...@gmail.com>
> wrote:
> >
> > Ralph, thanks for your reply! In the source code for SocketNode, I see
> this
> > line where it sets the following property for the LoggingEvent object:
> >
> > // store the known remote info in an event property
> > event.setProperty("log4j.remoteSourceInfo", remoteInfo);
> >
> > and remote info is the remote client address. Is there any way I can
> > retrieve this in the config file supplied to the socket server?
> >
> > On Tue, Jul 7, 2015 at 4:33 PM, Ralph Goers <ra...@dslextreme.com>
> > wrote:
> >
> >> I would suggest that you set the ip address in the ThreadContext at the
> >> beginning of each request or operation. Then all log events will contain
> >> that information.
> >>
> >> Sent from my iPad
> >>
> >>> On Jul 7, 2015, at 12:01 AM, Sandeep Dasika <da...@gmail.com>
> >> wrote:
> >>>
> >>> Hi log4j team,
> >>>
> >>> I have been using log4j in production systems, and it has delivered us
> >>> fantastically. My query is around the SocketAppender and
> >> SimpleSocketServer
> >>> functionality. We have a group of servers that generate log events.
> These
> >>> are configured to write to file appenders. We also want to have error
> >> logs
> >>> written to a central log file so that it can be easy to browse to find
> >>> potential issues in our product.
> >>>
> >>> I have the natural setup for the remote logging up and running
> perfectly
> >> -
> >>> The clients that generate the LoggingEvent objects (our production
> >> servers)
> >>> all write to a SocketAppender that will send it across to the remote
> >>> SimpleSocketServer and that ultimately writes to another file appender,
> >>> which gives us the centralised log file to browse. However, since we
> want
> >>> to run it at ERROR level, it would be best for us if we have some
> client
> >> ID
> >>> (maybe IP) of the client that sends a particular logging event at the
> >>> remote end so that it would be easier for us to pinpoint the problems
> in
> >>> our systems. Seems like I'm not sure how that can be done in log4j. Any
> >>> hints/suggestions on this would really help me out!
> >>>
> >>> Thanks in advance.
> >>> Cheers!
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>

Re: Query regarding SocketAppender and SimpleSocketServer

Posted by Ralph Goers <ra...@dslextreme.com>.
Yes. That property would be in the ThreadContext Map in the log event.

Sent from my iPad

> On Jul 7, 2015, at 5:32 AM, Sandeep Dasika <da...@gmail.com> wrote:
> 
> Ralph, thanks for your reply! In the source code for SocketNode, I see this
> line where it sets the following property for the LoggingEvent object:
> 
> // store the known remote info in an event property
> event.setProperty("log4j.remoteSourceInfo", remoteInfo);
> 
> and remote info is the remote client address. Is there any way I can
> retrieve this in the config file supplied to the socket server?
> 
> On Tue, Jul 7, 2015 at 4:33 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> 
>> I would suggest that you set the ip address in the ThreadContext at the
>> beginning of each request or operation. Then all log events will contain
>> that information.
>> 
>> Sent from my iPad
>> 
>>> On Jul 7, 2015, at 12:01 AM, Sandeep Dasika <da...@gmail.com>
>> wrote:
>>> 
>>> Hi log4j team,
>>> 
>>> I have been using log4j in production systems, and it has delivered us
>>> fantastically. My query is around the SocketAppender and
>> SimpleSocketServer
>>> functionality. We have a group of servers that generate log events. These
>>> are configured to write to file appenders. We also want to have error
>> logs
>>> written to a central log file so that it can be easy to browse to find
>>> potential issues in our product.
>>> 
>>> I have the natural setup for the remote logging up and running perfectly
>> -
>>> The clients that generate the LoggingEvent objects (our production
>> servers)
>>> all write to a SocketAppender that will send it across to the remote
>>> SimpleSocketServer and that ultimately writes to another file appender,
>>> which gives us the centralised log file to browse. However, since we want
>>> to run it at ERROR level, it would be best for us if we have some client
>> ID
>>> (maybe IP) of the client that sends a particular logging event at the
>>> remote end so that it would be easier for us to pinpoint the problems in
>>> our systems. Seems like I'm not sure how that can be done in log4j. Any
>>> hints/suggestions on this would really help me out!
>>> 
>>> Thanks in advance.
>>> Cheers!
>> 
>> 
>> ---------------------------------------------------------------------
>> 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


Re: Query regarding SocketAppender and SimpleSocketServer

Posted by Sandeep Dasika <da...@gmail.com>.
Ralph, thanks for your reply! In the source code for SocketNode, I see this
line where it sets the following property for the LoggingEvent object:

// store the known remote info in an event property
event.setProperty("log4j.remoteSourceInfo", remoteInfo);

and remote info is the remote client address. Is there any way I can
retrieve this in the config file supplied to the socket server?

On Tue, Jul 7, 2015 at 4:33 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> I would suggest that you set the ip address in the ThreadContext at the
> beginning of each request or operation. Then all log events will contain
> that information.
>
> Sent from my iPad
>
> > On Jul 7, 2015, at 12:01 AM, Sandeep Dasika <da...@gmail.com>
> wrote:
> >
> > Hi log4j team,
> >
> > I have been using log4j in production systems, and it has delivered us
> > fantastically. My query is around the SocketAppender and
> SimpleSocketServer
> > functionality. We have a group of servers that generate log events. These
> > are configured to write to file appenders. We also want to have error
> logs
> > written to a central log file so that it can be easy to browse to find
> > potential issues in our product.
> >
> > I have the natural setup for the remote logging up and running perfectly
> -
> > The clients that generate the LoggingEvent objects (our production
> servers)
> > all write to a SocketAppender that will send it across to the remote
> > SimpleSocketServer and that ultimately writes to another file appender,
> > which gives us the centralised log file to browse. However, since we want
> > to run it at ERROR level, it would be best for us if we have some client
> ID
> > (maybe IP) of the client that sends a particular logging event at the
> > remote end so that it would be easier for us to pinpoint the problems in
> > our systems. Seems like I'm not sure how that can be done in log4j. Any
> > hints/suggestions on this would really help me out!
> >
> > Thanks in advance.
> > Cheers!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

Re: Query regarding SocketAppender and SimpleSocketServer

Posted by Ralph Goers <ra...@dslextreme.com>.
I would suggest that you set the ip address in the ThreadContext at the beginning of each request or operation. Then all log events will contain that information.

Sent from my iPad

> On Jul 7, 2015, at 12:01 AM, Sandeep Dasika <da...@gmail.com> wrote:
> 
> Hi log4j team,
> 
> I have been using log4j in production systems, and it has delivered us
> fantastically. My query is around the SocketAppender and SimpleSocketServer
> functionality. We have a group of servers that generate log events. These
> are configured to write to file appenders. We also want to have error logs
> written to a central log file so that it can be easy to browse to find
> potential issues in our product.
> 
> I have the natural setup for the remote logging up and running perfectly -
> The clients that generate the LoggingEvent objects (our production servers)
> all write to a SocketAppender that will send it across to the remote
> SimpleSocketServer and that ultimately writes to another file appender,
> which gives us the centralised log file to browse. However, since we want
> to run it at ERROR level, it would be best for us if we have some client ID
> (maybe IP) of the client that sends a particular logging event at the
> remote end so that it would be easier for us to pinpoint the problems in
> our systems. Seems like I'm not sure how that can be done in log4j. Any
> hints/suggestions on this would really help me out!
> 
> Thanks in advance.
> Cheers!


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