logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <...@qos.ch>
Subject RE: Log4j improvement
Date Tue, 03 Jul 2001 08:23:59 GMT

Hello Pavel,

At 12:07 03.07.2001 +0400, Pavel Muhataev wrote:
>> 1) It's already provided via the "locationInfo" in 
>> LoggingEvent.  If you want to see it, use your layout's means 
>> for doing so.  (For example, PatternLayout will show 
>> everything you mentioned and more.)  It's usually not used 
>> because it dramiticly slows things down, but if you've got 
>> the speed to spare and want that info, it's available for you.
>I didn't talk about discovering log caller's method. I talked about
>automatically Category determining. In such case, user would not have to get
>Category before logging.
>Instead of Category.getInstance(_My_object_.class.getName()).debug(...) code
>would be Log.debug(...).

The extraction of caller information is not reliable. We cannot build a system on an unreliable

>> 3) Usually, the default render for objects is sufficient 
>> since most objects provide a reasonable toString() method.  
>> However, if you want something fancier (like in the code you 
>> linked to) you can override the default behavior for various 
>> types of objects by providing your own ObjectRenders (in the 
>> org.apache.log4j.or package) and registering them with the 
>> RendererMap (available from the Hierarchy).  See the JavaDocs 
>> for more information.
>I think it would be useful to add capability of dumping object. On my last
>project I spent a lot of time when discovering properties of objects, used
>in my project. By using such code it would be more simple to debug projects.
>Adding object's dumper as default renderer for user-defined objects would be
>not very efficient. On every new project you would have to change dumped
>objects. I think, that it is not convenient.

Some competing logging packages offer the functionality of dumping objects. I am not sure
automated object dumps are a good idea. For the following reasons:

1) The amount of (automated) output per object can be large which may cause scrolling-blindness.

2) The extraction process will be slow.

If you *really* want to see the inners of an object you write an object renderer for it. This
takes a little effort but it is fast and will output only the information that you deem useful.

Regards, Ceki

>> >  -----Original Message-----
>> > From:       Pavel Muhataev [mailto:PavelM@moscow.vestedev.com] 
>> > Sent:       Monday, July 02, 2001 10:09 AM
>> > To: log4j-dev@jakarta.apache.org
>> > Subject:    Log4j improvement
>> > 
>> > Hi all
>> > 
>> > I'd like to suggest three features to log4j project:
>> > 1) Automatically category determining by package, class and 
>> method name
>> > 2) Capability of configuration ResourceBundle in configuration file
>> > 3) Object dumping capability.
>> > 
>> > Explanations:
>> > 1) Log4j have capability of automatically configuration 
>> loading at run-time. But we need to get category object 
>> before logging. Adding capability of automatically category 
>> determining would make log4j more easily to use.
>> > There must be some universal class with static methods for 
>> logging. (debug, info, etc.) When calling this methods 
>> package, class and method name must be determined (may be by 
>> using Throwable.printStackTrace).
>> > 
>> > 2) There are a great capability of using ResourceBundles. 
>> But it can't be configured by configure files. I think, such 
>> capability must be added
>> > 
>> > 3) I think, it would be very useful to add capability of 
>> printing some Java object's dump.
>> > 
>> > 
>> > Here is source code of program : 
>> http://pavlinchik.chat.ru/Java/log4j/Log.java
>> > 
>> > 
>> > Paul Mykhataew, ICQ # 33733798 << File: ATT00002.txt >> 
>To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

Ceki Gülcü

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

View raw message