0

Apparently, there is a new constructor for the log4j FileAppender class.

In the past, one could choose between several constructors and wasn't forced to pass more than three parameters to the constructor (see: https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/FileAppender.html) .

Now, the FileAppender class has been moved from org.apache.log4j to org.apache.logging.log4j.core.appender.

Now the constructor for FileAppender looks as follows:

FileAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
        final FileManager manager, final String filename, final boolean ignoreExceptions,
        final boolean immediateFlush, final Advertiser advertiser)

What is a Filter and what is an Advertiser? (Where is the documentation on this new kind of FileAppender anyway - I didn't find anything.)

(I'm trying to write an initialisation servlet for the logger.)

steady_progress
  • 3,311
  • 10
  • 31
  • 62
  • 1
    [Here is some doc](http://logging.apache.org/log4j/2.x/manual/customconfig.html) that might help for programmatic configuration. You don't call the constructor yourself, you use a builder... that is, when you have found a way to get a hold on the "configuration" object... and call the various `.withFoo()` and `.withBar()` in the right order... All of that will depend on what you want to do exactly so I can't provide (or have the courage tbh) for a proper answer. Yeah it used to be *much* simpler... *sigh*. But at least this page makes an effort to explain how to do that for various situations. – Hugues M. Jun 18 '17 at 23:41
  • Thanks for that !! – steady_progress Jun 19 '17 at 19:09

0 Answers0