Re: DefaultRolloverStrategy.createStrategy - access the appender

2016-10-07 Thread Gary Gregory
I don't quite see how to do that without inventing some kind of build
context object that gets passed around. Any one else?

Gary

On Fri, Oct 7, 2016 at 2:43 PM, Benjamin Jaton 
wrote:

> Hello,
>
> When configuring the rollover strategy for an appender, is there a way to
> access the name of the appender from this method:
> DefaultRolloverStrategy.createStrategy ?
>
> I'm trying to write my own and I could use that name for my implementation.
>
> Thanks,
> Benjamin
>



-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition

JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


DefaultRolloverStrategy.createStrategy - access the appender

2016-10-07 Thread Benjamin Jaton
Hello,

When configuring the rollover strategy for an appender, is there a way to
access the name of the appender from this method:
DefaultRolloverStrategy.createStrategy ?

I'm trying to write my own and I could use that name for my implementation.

Thanks,
Benjamin


Re: "" cause html log file cannot be displayed correctly.

2016-10-07 Thread Gary Gregory
Emi,

This is odd, in 2.7, the method

org.apache.logging.log4j.core.layout.HtmlLayout.getHeader()

writes more header bytes before it gets to:



Looking at the code I do not see how an HTML file written by Log4j 2.7 can
start with a body tag.

Can you verify that only Log4j 2.7 is on the classpath?

Thank you,
Gary


On Fri, Oct 7, 2016 at 8:08 AM, Emi  wrote:

> Hello,
>
> Tried log4j2.7, when stop/reload tomcat, html log file shows wrong format.
>
> This happens only when there are already previous records in the html log
> file.
>
>
> Debug steps:
> 
> (1) run login and log one/two records in html format
>
> (2) stop webapp
> reinstalled webapp
> start webapp
>
> or just reload webapp
>
> (3) run login and log record
>
> test.html will be shown as:
>
>
> 
> 
> Log session start time Fri Oct 07 10:42:05 EDT 2016
> 
>  width="100%">
> 
> Time
> Thread
> Level
> Logger
> Message
> 
>
> 
> 237858
> http-bio-8080-exec-22
> DEBUG
> ProcessLogin
> 2016-10-07 10:42:25 username: abc trying to login
> 
>
>
> 
> 
> 
>
>
> 
> 344092
> http-bio-8080-exec-29
> DEBUG
> ProcessLogin
> 2016-10-07 10:44:11 username: abc trying to login
> 
>
>
>
> "" cause the html cannot be displayed correctly.
>
>
> If this cannot be fixed, can someone let me know is there a way when
> reinstall webapp or reload webapp from tomcat, there will always a new log
> file generated?
>
> Want to upgrade jars from 2.3 to new version; log4j2.3 never with this
> problem.
>
> Thanks a lot!
> --
> . tomcat 7.0.70
> . log4j2.xml
> fileName="@log4j.debug.html@"
>filePattern="@log4j.debug.html@-%i.html">
>  
>
>  
> 
> 
>  
> 
>



-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition

JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


"" cause html log file cannot be displayed correctly.

2016-10-07 Thread Emi

Hello,

Tried log4j2.7, when stop/reload tomcat, html log file shows wrong format.

This happens only when there are already previous records in the html 
log file.



Debug steps:

(1) run login and log one/two records in html format

(2) stop webapp
reinstalled webapp
start webapp

or just reload webapp

(3) run login and log record

test.html will be shown as:




Log session start time Fri Oct 07 10:42:05 EDT 2016

width="100%">


Time
Thread
Level
Logger
Message



237858
http-bio-8080-exec-22
DEBUG
ProcessLogin
2016-10-07 10:42:25 username: abc trying to login









344092
http-bio-8080-exec-29
DEBUG
ProcessLogin
2016-10-07 10:44:11 username: abc trying to login




"" cause the html cannot be displayed correctly.


If this cannot be fixed, can someone let me know is there a way when 
reinstall webapp or reload webapp from tomcat, there will always a new 
log file generated?


Want to upgrade jars from 2.3 to new version; log4j2.3 never with this 
problem.


Thanks a lot!
--
. tomcat 7.0.70
. log4j2.xml