Re: Log4j2 script to generate hash

2016-11-08 Thread Remko Popma
All filter methods have a Logger object as the first parameter. Can you use that? Sent from my iPhone > On 9 Nov 2016, at 9:45, Benjamin Jaton wrote: > > As far as I know, there is no way for a global filter to know which logger > we're working it for. > Which in my case is not the best since

Re: Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
As far as I know, there is no way for a global filter to know which logger we're working it for. Which in my case is not the best since I would compute a hash for all the messages of all my loggers, instead of just the one I need them for. On Tue, Nov 8, 2016 at 4:30 PM, Benjamin Jaton wrote: >

Re: Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
Ah, I can't use 'logEvent' but I can use 'message', perfect, thank you! On Tue, Nov 8, 2016 at 4:21 PM, Remko Popma wrote: > Yes Filters can be applied at different stages of the logging pipeline. > The Filter interface has separate methods for these stages. Different > parameters are passed to

Re: Log4j2 script to generate hash

2016-11-08 Thread Remko Popma
Yes Filters can be applied at different stages of the logging pipeline. The Filter interface has separate methods for these stages. Different parameters are passed to these methods. Sent from my iPhone > On 9 Nov 2016, at 8:57, Benjamin Jaton wrote: > > Ah, interesting. I seem to be able to

Re: Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
Ah, interesting. I seem to be able to make modification using this global filter. However I don't seem to have access to the log event that way? Caused by: groovy.lang.MissingPropertyException: No such property: logEvent for class: Script2 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.

Re: Log4j2 script to generate hash

2016-11-08 Thread Remko Popma
If you make it a global filter it will get applied before the LogEvent is constructed. Please try that. Remko Sent from my iPhone > On 9 Nov 2016, at 7:02, Benjamin Jaton wrote: > > I am applying it on the root logger. > >> On Tue, Nov 8, 2016 at 12:47 PM, Matt Sicker wrote: >> >> Where a

Re: Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
I am applying it on the root logger. On Tue, Nov 8, 2016 at 12:47 PM, Matt Sicker wrote: > Where are you applying the filter? On the appender or somewhere else? > > On 8 November 2016 at 13:13, Benjamin Jaton > wrote: > > > hello, > > > > I was playing with log4j2 filters to generate a hash in

Example of using Log4jContextFactory?

2016-11-08 Thread COHEN, STEVEN M
The goal: to configure log4j2 logging on a standalone EJB deployed to a JBoss EAP7 server in an EJB jar. We do not wish to use the loggers supplied by JBoss for our applications. I find that I can deploy a log4j2.xml file at the root of the ejb jar and it does get seen by JBoss but logging st

Re: Log4j2 script to generate hash

2016-11-08 Thread Matt Sicker
Where are you applying the filter? On the appender or somewhere else? On 8 November 2016 at 13:13, Benjamin Jaton wrote: > hello, > > I was playing with log4j2 filters to generate a hash in groovy that I would > put in the threadcontext map, and then use in my log pattern: > > %d{-MM-dd HH:m

Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
hello, I was playing with log4j2 filters to generate a hash in groovy that I would put in the threadcontext map, and then use in my log pattern: %d{-MM-dd HH:mm:ss} %-5p %c{1.}:%L - %m [%X{myhash}] But the hash is printed on the NEXT log message. My understanding is that at this point the lo

Re: Problem using LocalizedMessageFactory: Logger prints key instead of messsage

2016-11-08 Thread Markus Waidhofer
Done: https://issues.apache.org/jira/browse/LOG4J2-1682 On 11/08/2016 09:32 AM, Remko Popma wrote: Not sure if this is a bug or not but the described behavior sounds surprising... Would you mind creating a JIRA ticket for this? Sent from my iPhone On 8 Nov 2016, at 16:20, Markus Waidhofer w

Re: Problem using LocalizedMessageFactory: Logger prints key instead of messsage

2016-11-08 Thread Remko Popma
Not sure if this is a bug or not but the described behavior sounds surprising... Would you mind creating a JIRA ticket for this? Sent from my iPhone > On 8 Nov 2016, at 16:20, Markus Waidhofer wrote: > > Hi, > > I am having a problem when logging localized messages. I use a Logger with > the