Curt Arnold | 2 Aug 2006 23:48
Picon
Favicon

Re: The data not inserting in Logging_event_exception,Logging_event_property tables.


On Aug 2, 2006, at 5:37 AM, ysuneelreddy wrote:

> Hi.
>
> Iam working on Log4j-1.3alpha-8
>
> Iam facing problem like.
>
> The log messages inserting only one table logging_event
>
> The data not inserting in  
> Logging_event_exception,Logging_event_property
> tables.

You are close to being completely ignored by people who are inclined  
to help.  You have been previously cautioned on proper mailing list  
etiquette.  In this case, it appears that you have asked basically  
the same question 5 or 6 times in very quick succession and have  
ignored the responses that you have received.

The reason that there are no entries in the logging_event_exception  
and logging_event_property tables are that there is no exception or  
property associated with your logging requests.  The only reason they  
exist as distinct tables is that their is not a 1-1 correspondence  
between logging events and exceptions or logging events and  
properties.  A logging event will only have an associated exception  
if you pass one in on the call like:

try {
...
} catch(Exception e) {
     logger.error("Attempt to create foobar failed", e);
}

An logging event will only have associated properties if you call  
MDC.put() or LoggerRepository.setProperty.

MDC.put("ipaddr", ipaddr);
MDC.put("username", "ysuneelreddy");
...
logger.info("Starting transaction");

If you looked at the code for DBAppender.java, you could see that  
entries into logging_event_exception are inserted at line 319 and  
that block is conditional on event.getThrowableStrRep() != null.  You  
should then ask yourself, when would event.getThrowableStrRep() ==  
null.  And it would come to you, that probably when I didn't have a  
Throwable as part of the event.

A similar analysis of the code around line 286 would show that there  
are no entries in that table when propertyKeys.size() == 0.

Gmane