Dear all,

 

I have a question to HTMLLayout.

I have written the following code:

 

           LayoutWrappingEncoder htmlEncoder = new LayoutWrappingEncoder();

           HTMLLayout htmlLayout = new HTMLLayout();

           htmlLayout.setPattern("%relative%thread%mdc%level%logger%msg");

           htmlLayout.start();

           htmlEncoder.setContext(loggerContext);

           htmlEncoder.setLayout(htmlLayout);

           htmlEncoder.start();

          

           PatternLayoutEncoder encoder = new PatternLayoutEncoder();

           encoder.setContext(loggerContext);

           encoder.setPattern("%r %thread %level - %msg%n");

           encoder.start();

 

             

              fileAppender.setContext(this.loggerContext);

           fileAppender.setFile(FilenameUtils.concat(storeLocation, "logFile.log.html"));

           fileAppender.setName("File Validation Log");

           fileAppender.setEncoder(htmlEncoder);

 

           fileAppender.start();

           this.logger.addAppender(fileAppender);

          

           StatusPrinter.print(loggerContext);

 

But it does not log anything. It creates a html file but only includes the header line.

Using the “encoder” it works fine.

I don’t want to use Logfiles and do this programmatically.

Can anyone give me a hint what is wrong here?

 

Best regards,

Michael