Hello,
I've prepared ACLAppender which extends non-serializable
AppenderSkeleton. This appender is attached to SystemAgent's logger,
which is <transient> field of the Agent. But during serialization
(standard -- no changes made to writeObject() method) I got
java.io.NotSerializableException: jacs.core.debug.ACLAppender
I suppose this could be caused by <NON-transient> references to the
appender (the only one I know is reference to the SystemAgent instance
passed by ACLAppender constructor) thus I decided to call
beforeSerialization() method and re-create logger after successful
serialization.
Please see the code below:
---
public class SystemAgent extends Agent {
protected transient Logger logger;
protected void setup() {
logger = Logger.getLogger(getLoggerName());
logger.addAppender(new ACLAppender(this));
}
protected void beforeSerialization() {
Appender appender = logger.getAppender(ACLAppender.ACL_APPENDER_NAME);
appender.close();
logger.removeAllAppenders();
appender = null;
LogManager.shutdown();
logger = null;
}
}
---
Unfortunately there is still the exception. Do you know why?
I would be greatful for any help,
Regards,
Maciej
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]