Re: Log4j2 script to generate hash

2016-11-10 Thread Matt Sicker
Please do open an issue. Otherwise, this will probably get lost in the mailing lists. On 10 November 2016 at 18:33, Benjamin Jaton wrote: > I have a weird problem where using a global script seems to cause log4j to > not be able to resolve my properties any more: > >

Re: Log4j2 script to generate hash

2016-11-10 Thread Benjamin Jaton
I have a weird problem where using a global script seems to cause log4j to not be able to resolve my properties any more: Log4j2 2.7 The code: System.setProperty("log4j.configurationFile", "/usr/local/apps/test.json"); LogManager.getLogger(Test.class).error("test"); The conf: {

Re: Log4j2 script to generate hash

2016-11-10 Thread Benjamin Jaton
Ah, indeed, I have access to a variable named "logger", excellent. Here is the script I am trying to use: --- import java.security.MessageDigest import org.apache.logging.log4j.ThreadContext def genmd5(String s) { MessageDigest.getInstance("MD5").digest(s.bytes).encodeHex().toString() }

Re: Log4j2 script to generate hash

2016-11-10 Thread Remko Popma
Can you show your script? Looking at the code, the documentation is wrong and the Logger object is bound to variable "logger" instead. Which variables are available depends on which filter method is called. This depends on where the filter is configured. The LogEvent is not available for

Re: Log4j2 script to generate hash

2016-11-10 Thread Benjamin Jaton
Sure, here it is: { "configuration" : { "status" : "warn", "scripts": { "ScriptFile": { "name":"test.filter", "path": "/usr/local/apps/test.groovy" } }, "ScriptFilter": { "onMatch": "ACCEPT", "onMisMatch": "DENY", "ScriptRef": { "ref": "test.filter" }

Re: Log4j2 script to generate hash

2016-11-10 Thread Remko Popma
Can you show your configuration? Sent from my iPhone > On 11 Nov 2016, at 1:56, Benjamin Jaton wrote: > > I tried all the variables in the doc, no luck: > > Caused by: groovy.lang.MissingPropertyException: No such property: > loggerName for class: Script2 >at >

Re: Log4j2 script to generate hash

2016-11-10 Thread Benjamin Jaton
I tried all the variables in the doc, no luck: Caused by: groovy.lang.MissingPropertyException: No such property: loggerName for class: Script2 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53) at

Re: Disruptor memory management

2016-11-10 Thread Remko Popma
Yes, this is the default. You can can reduce the ring buffer size in the configuration to reduce memory consumption. An alternative is to switch off garbage-free mode by setting system property "log4j2.enable.threadlocals" to false. This will cause Log4j to cache less and allocate temporary