On Jan 22, 2007, at 10:13 AM, [EMAIL PROTECTED] wrote:

Hi,

Log4j works in objects that implements Serializable?

If so, how this is possible? If a client receives an object from the server that
implements Serializable, how the client knows how to interpret log4j
instructions?

Sincerely,
Pedro


I am not sure I understand your question.

The most common pattern of using log4j is for a class to have a static member representing to logger, something like:

class MyClass implements Serializable {
private static final Logger logger = Logger.getLogger (MyClass.class);
    ...
}

With this pattern, the logger is not an instance variable of the class and is not serialized with the class. On the receiving end, the value of MyClass.logger will be initialized when MyClass is loaded which may be when the first instance of the class is deserialized. The log4j.jar will need to be on the classpath for the receiving application. If log4j has not been configured before deserializing, the receiving application will be configured following the default configuration pattern (that is looking for log4j.properties and log4j.xml). It would be totally possible for the logger on the sending end to have a different threshold than on the receiving end.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to