> -----Ursprüngliche Nachricht-----
> Von: Bender Heri [mailto:HBender@Ergonomics.ch]
>
> hi Wyssli
:-] sali, heri
> 1. Maybe I cited the wrong desing pattern. You probably right
> that the strategy pattern would match cleaner (it's an
> academic question).
excuse me for being academic :-D
to be serious again: maybe i did not understand your original post. in your answer to leo
you wrote that "my proposal is valid for all FileAppender's and its derivations". however
i tought about writing an appender ("MultiFileAppender" to take curts naming) which does call
the FileNameBuilder.
is there a possibillity to have the desired behaviour for all appenders (without having to
change them) when you use the visitor pattern (which i possibly didn't understand correctly)?
> 2. It's also a good idea to provide the method buildFileName
> with the LoggingEvent. But the involved appender should also
> be known (in order to get the configured filename).
yep, that's true i forgot that.
> 3. I don't understand your proposal "closeFileAfter()"
> depending on the event. Who should call this? The appender?
> The log4j user?
well the idea was that the appender would call it.
it would call something like:
filename = myFileNameBuilder.buildFilename(appender, event);
myFileAppender.setFilename(filename)
myFileAppender.subAppend(event);
if (myFileNameBuilder.closeFileAfter(appender, event)) {
myFileAppender.closeFile();
}
the log4j user would do a special log event if he wants to close the file (for example if
he knows that the file can be closed because the session/thread/whatever is over), e.g. a
log event containing a certain text/MDC-key etc.
> I think a configurable timeout would be the
> way. See my response to Leo Lima some minutes ago.
yep, i too like the idea of a timeout and the diea of a maxOpenFiles (as proposed by curt).
the appender would have a list of open writters and close the ones older than timeout or the
oldest if maxOpenFiles is kicking in. i would suggest that this happens in append() and not
in a thread of its own.
best regards
patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
|