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 fachhoch <fa...@gmail.com> on 2011/07/12 20:51:58 UTC

append user details with exception stacktrace

can I add additional information when log4j logs exceptions ?,  my root
logger logs all errors ,   can I add a new line to the exception  stacktrace  
ie user details which is in threadlocal , is there any customization I can
do before message is logged to logs ? 
-- 
View this message in context: http://old.nabble.com/append-user-details--with-exception-stacktrace-tp32048303p32048303.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Re: append user details with exception stacktrace

Posted by Jacob Kjome <ho...@visi.com>.
Yes.  Read up on NDC and MDC [1].  A quick web search should give you even 
more information.

[1] http://wiki.apache.org/logging-log4j/NDCvsMDC


Jake

On Thu, 14 Jul 2011 08:45:35 -0700 (PDT)
 fachhoch <fa...@gmail.com> wrote:
> 
> My application is configured to use log4j , all over in my code I use
> log.debug  to log messages.
> and exceptions are automatically logged,if some exception happens its
> automatically logged.
> 
> I am asking if it is possible to configure log4j to add user information  to
> the message before it logs.
> 
> 
> if an exception happens  log4j logs the exception stack trace  , I am asking
> If I can configure log4j to append additional information along with the
> stack trace , this additional information I mean user details from
> threadlocal.
> 
> does this makes sense ?
> 
> 
> Jacob Kjome wrote:
>> 
>> 
>> Can you restate the question?  It's not clear to me what you are trying to
>> do, 
>> which is likely why you haven't received an answer.
>> 
>> Jake
>> 
>> On Thu, 14 Jul 2011 07:47:45 -0700 (PDT)
>>  fachhoch <fa...@gmail.com> wrote:
>>> 
>>> any help please ?  I want to modify the message which log4j is going to
>>> log 
>>>,
>>> please help me 
>>> 
>>> 
>>> fachhoch wrote:
>>>> 
>>>> can I add additional information when log4j logs exceptions ?,  my root
>>>> logger logs all errors ,   can I add a new line to the exception 
>>>> stacktrace   ie user details which is in threadlocal , is there any
>>>> customization I can do before message is logged to logs ? 
>>>> 
>>> 
>>> -- 
>>> View this message in context: 
>>>http://old.nabble.com/append-user-details--with-exception-stacktrace-tp32048303p32061804.html
>>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> 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
>> 
>> 
>> 
> 
> -- 
> View this message in context: 
>http://old.nabble.com/append-user-details--with-exception-stacktrace-tp32048303p32062262.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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: append user details with exception stacktrace

Posted by fachhoch <fa...@gmail.com>.
My application is configured to use log4j , all over in my code I use
log.debug  to log messages.
and exceptions are automatically logged,if some exception happens its
automatically logged.

I am asking if it is possible to configure log4j to add user information  to
the message before it logs.


if an exception happens  log4j logs the exception stack trace  , I am asking
If I can configure log4j to append additional information along with the
stack trace , this additional information I mean user details from
threadlocal.

does this makes sense ?


Jacob Kjome wrote:
> 
> 
> Can you restate the question?  It's not clear to me what you are trying to
> do, 
> which is likely why you haven't received an answer.
> 
> Jake
> 
> On Thu, 14 Jul 2011 07:47:45 -0700 (PDT)
>  fachhoch <fa...@gmail.com> wrote:
>> 
>> any help please ?  I want to modify the message which log4j is going to
>> log 
>>,
>> please help me 
>> 
>> 
>> fachhoch wrote:
>>> 
>>> can I add additional information when log4j logs exceptions ?,  my root
>>> logger logs all errors ,   can I add a new line to the exception 
>>> stacktrace   ie user details which is in threadlocal , is there any
>>> customization I can do before message is logged to logs ? 
>>> 
>> 
>> -- 
>> View this message in context: 
>>http://old.nabble.com/append-user-details--with-exception-stacktrace-tp32048303p32061804.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/append-user-details--with-exception-stacktrace-tp32048303p32062262.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Re: append user details with exception stacktrace

Posted by Jacob Kjome <ho...@visi.com>.
Can you restate the question?  It's not clear to me what you are trying to do, 
which is likely why you haven't received an answer.

Jake

On Thu, 14 Jul 2011 07:47:45 -0700 (PDT)
 fachhoch <fa...@gmail.com> wrote:
> 
> any help please ?  I want to modify the message which log4j is going to log 
>,
> please help me 
> 
> 
> fachhoch wrote:
>> 
>> can I add additional information when log4j logs exceptions ?,  my root
>> logger logs all errors ,   can I add a new line to the exception 
>> stacktrace   ie user details which is in threadlocal , is there any
>> customization I can do before message is logged to logs ? 
>> 
> 
> -- 
> View this message in context: 
>http://old.nabble.com/append-user-details--with-exception-stacktrace-tp32048303p32061804.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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


AW: append user details with exception stacktrace

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
The event is getting to log
The logger.level says what gets passed to appenders
The appender.threshold says what the appender sends to the outside world 
The filters says (if any) what can pass to the outside world
The formatters say how the event.message is formatted 

Now what you like to know?

Josef

-----Ursprüngliche Nachricht-----
Von: fachhoch [mailto:fachhoch@gmail.com] 
Gesendet: Donnerstag, 14. Juli 2011 16:48
An: log4j-user@logging.apache.org
Betreff: Re: append user details with exception stacktrace


any help please ?  I want to modify the message which log4j is going to log ,
please help me 


fachhoch wrote:
> 
> can I add additional information when log4j logs exceptions ?,  my root
> logger logs all errors ,   can I add a new line to the exception 
> stacktrace   ie user details which is in threadlocal , is there any
> customization I can do before message is logged to logs ? 
> 

-- 
View this message in context: http://old.nabble.com/append-user-details--with-exception-stacktrace-tp32048303p32061804.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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



Re: append user details with exception stacktrace

Posted by fachhoch <fa...@gmail.com>.
any help please ?  I want to modify the message which log4j is going to log ,
please help me 


fachhoch wrote:
> 
> can I add additional information when log4j logs exceptions ?,  my root
> logger logs all errors ,   can I add a new line to the exception 
> stacktrace   ie user details which is in threadlocal , is there any
> customization I can do before message is logged to logs ? 
> 

-- 
View this message in context: http://old.nabble.com/append-user-details--with-exception-stacktrace-tp32048303p32061804.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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