Hello
After an initial configuration of log4j2 with:
Configurator.initialize(null, configLocation);
I would like to reinitialize it with a different URL
Configurator.initialize(null, configLocation2);
The problem is that the second call is ignored. I believe that once the
LoggerContext
This works great thanks!
On Fri, Jun 5, 2015 at 9:22 PM, Ralph Goers
wrote:
> Once you have a LoggerContext you can call
> context.setConfigLocation(configLocation) where configLocation is a URI.
> That will force a reconfiguration.
>
> Ralph
>
> > On Jun 5, 2015, at
Hello,
I am trying to create a filter at the appender level that would show all
the messages that contain "Show".
This is my test:
LogManager.getLogger(Test.class).debug("Hide me!");
LogManager.getLogger(Test.class).info("test");
LogManager.getLogger(Test.class).debug("Sho
gt; make it past that.
>
> Ralph
>
>
> > On Jun 25, 2015, at 3:39 PM, Benjamin Jaton
> wrote:
> >
> > Hello,
> >
> > I am trying to create a filter at the appender level that would show all
> > the messages that contain "Show".
> > T
Hello,
How can I define a RollingFileAppender that would roll when it reaches
100MB, and that would discard any log older than 30 days (not before)?
I need to keep 30 days of logs for auditing purposes, but I also want to
limit the logs to a certain size as well.
Thanks!
Ben
10:22 (GMT-08:00)
> To: Log4J Users List
> Subject: Re: RollingFileAppeneder MaxSize + keep 30 days
>
> If you're stuck on Log4J 1.2 then you could try out the
> TimeAndSizeRollingAppender available at www.simonsite.org.uk.
>
> Sent from TypeMail
>
>
>
> On
Bump.
So far my only option is to not use a size limit at all, and only use a "1
per day" policy and keep 30 files.
Any pointer would be greatly appreciated.
On Fri, Jul 3, 2015 at 4:51 PM, Benjamin Jaton
wrote:
> I'm sorry my question was for log4j2, I should have been more
Hello,
Do you know if there is any implementation of an SNMP appender for log4j2?
I found this http://code.google.com/p/log4j-snmp-trap-appender/ but I think
it is exclusively for log4j1.
Thanks
Benjamin
Hello,
I am using the JDBCAppender:
{
"type" : "Jdbc",
"name" : "MyDatabaseAppender",
"tableName" : "LOGS",
"ignoreExceptions" : "false",
"ConnectionFactory" : {
"class" : "test.ConnectionFactory",
"method" : "getDatabaseAppenderDataSource"
},
"Column" : [
{ "name" : "I
uot;NULL", even if I write a custom
PatternConverter.
On Tue, Jul 21, 2015 at 5:21 PM, Remko Popma wrote:
> Have you tried ThreadContext.remove("NUM")?
>
> Remko
>
> Sent from my iPhone
>
> > On 2015/07/22, at 7:45, Benjamin Jaton wrote:
> >
>
Hello,
I am using this configuration :
%d %p %c{1.} [%t] %m%n
**
I am changing the DefaultRolloverStrategy "max" attribute from 5 to 10.
I can see the reloading take place from the StatusLogger (full log
Whoops, here are the logs.
On Fri, Jul 24, 2015 at 12:17 PM, Benjamin Jaton
wrote:
> Hello,
>
> I am using this configuration :
>
>
>
>
> filePattern="/tmp/test/app.log.%i">
>
Hello,
Here is a simple configuration:
**
**
**
I am trying to programmatically set the log level of "com.rli", but I can't
find the Loggers until they are used:
*System.setProperty("log4j.configurationFi
gt;
> Gary
>
> On Tue, Oct 20, 2015 at 3:13 PM, Benjamin Jaton
> wrote:
>
> > Hello,
> >
> > Here is a simple configuration:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > **
> &
Hi,
I am using the SMTPAppender with a custom pattern:
"PatternLayout" : { "pattern" : "%m" }
But the email is sent as text.
I saw that there is a HTMLLayout but it doesn't seem to accept a pattern?
How can I produce a custom HTML message?
Thanks!
Ben
der.
>
> This manual page may be a good place to get started:
> http://logging.apache.org/log4j/2.x/manual/extending.html#Layouts
>
> Best regards,
> Remko
>
> > On 2015/11/06, at 4:55, Benjamin Jaton wrote:
> >
> > Hi,
> >
> > I am using the SMTPAp
t; On Mon, Nov 9, 2015 at 11:09 AM, Benjamin Jaton
> wrote:
>
> > Thanks the feedback.
> > I found that the easiest way to achieve this was to have the
> PatternLayout
> > class support to set the contentType to "text/html".
> > Then one can write HTML directly i
Hi,
I am wondering if it would make sense to have a maxDelayMillis parameter
for the RollingFileAppender (like FlumeAppender).
Use case:
You have a web server access log, you produce an HTTP request and expect to
see it (and the response) in the access logs right away-ish (or at least
control how
will create a Jira for this.
>
> Remko
>
> > On 2015/11/11, at 5:16, Gary Gregory wrote:
> >
> > And more generally, can all appenders benefit from such a setting?
> >
> > Gary
> >
> > On Tue, Nov 10, 2015 at 11:04 AM, Benjamin Jaton <
> benja
interweave HTML?
> On 10 November 2015 at 11:57, Benjamin Jaton
> wrote:
>
> > I am trying to use a logger in order to send "alerts" to the user. So for
> > me 1 log = 1 email (hence LOG4J2-1071).
> > I use the regular PatternLayout to produce a simple but f
Thanks a lot for the explanation, much clearer now.
Here is the JIRA: https://issues.apache.org/jira/browse/LOG4J2-1197
On Tue, Nov 10, 2015 at 11:39 PM, Remko Popma wrote:
> On Wed, Nov 11, 2015 at 2:34 PM, Benjamin Jaton
> wrote:
>
> > On Tue, Nov 10, 2015 at 6:13 PM, Remko P
Hi all,
I am using the ThreadContext a lot, but I am sometimes in a situation where
I would need to set some variable for a task that runs in a thread that
might spawn children threads. I need that logging variable to be also
available to those child threads.
Unless I create the sub threads manua
che.org/log4j/2.x/manual/thread-context.html
>
>
> Sent from my iPhone
>
> > On 2016/04/27, at 8:58, Benjamin Jaton wrote:
> >
> > Hi all,
> >
> > I am using the ThreadContext a lot, but I am sometimes in a situation
> where
> > I would need
Hello,
I have a simple appender like:
{
"type" : "smtp",
"name" : "EmailAppender",
"subject" : "${email.subject}",
"to" : "${email.recipient}",
"from" : "${email.from}",
"smtpProtocol" : "${email.smtp.protocol}",
"smtpHost" : "${email.smtp.h
ter solution, though. You can programmatically cause a
> reconfiguration as well.
>
> On 27 June 2016 at 13:17, Benjamin Jaton wrote:
>
> > Hello,
> >
> > I have a simple appender like:
> >
> > {
> > "type" : "smtp",
> >
input string: "${email.smtp.port}"
---
Thanks
Ben
On Mon, Jun 27, 2016 at 3:36 PM, Remko Popma wrote:
> Have you tried configuring with two leading '$' characters?
>
> http://logging.apache.org/log4j/2.x/manual/configuration.html#RuntimeLookup
>
>
>
pender (but perhaps
> others think differently).
>
> Without looking at the code, supporting dynamically evaluation of double
> $'s in SmtpAppender seems like a good approach. Can you raise a Jira
> feature request for that?
>
> Sent from my iPhone
>
> > On 20
Hello again,
Is there a way to define a set appenders/logger/props and use them in
several log4j2 configuration files?
Like:
I define sub-conf C
Then I create conf A that "imports" C,
and conf B that "imports" C as well.
I know about x:include (https://issues.apache.org/jira/browse/LOG4J2-341),
4j/2.x/manual/configuration.html#CompositeConfiguration
> .
>
> Ralph
>
> > On Jun 29, 2016, at 3:00 PM, Benjamin Jaton
> wrote:
> >
> > Hello again,
> >
> > Is there a way to define a set appenders/logger/props and use them in
> > several log4j2 c
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
Hello,
I wonder about the relationship between the max attribute and the
IfAccumulatedFileCount.
I had wrongly assumed that if you used the Delete policy, then the max
attribute wasn't needed.
But that resulted in having a cap on the number of log files to 7 (which is
the DEFAULT_WINDOW_SIZE in D
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
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 log
>
> 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 are you applying the filter? On the appe
rent
> 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 make modification using this global
> > filter.
> >
> > H
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
gt;
> > 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 I would compute a hash for all the
> > messages of all
> > Then I tried:
> >
> > println(parameters)
> >
> > But it returns 'null'
> >
> >> On Tue, Nov 8, 2016 at 5:18 PM, Remko Popma
> wrote:
> >>
> >> All filter methods have a Logger object as the first parameter. Can you
>
uot;,
"additivity" : "false",
"includeLocation" : "true",
"AppenderRef" : {
"ref" : "STDOUT"
}
}
}
}
}
On Thu, Nov 10, 2016 at 9:01 AM, Remko Popma wrote:
> Can you
he/logging/log4j/core/
> filter/ScriptFilter.java
>
>
>
>
> Sent from my iPhone
>
> > On 11 Nov 2016, at 7:15, Benjamin Jaton
> wrote:
> >
> > Sure, here it is:
> >
> > {
> > "configuration" : {
> >"status&qu
quot; : {
"ref" : "STDOUT"
}
}
}
}
}
The output without the highlighted section:
test (Logger log level = INFO)
The output with the highlighted section:
2016-11-10 16:30:25,351 main WARN Error while converting string
[${server.log.level}]
Reported here: https://issues.apache.org/jira/browse/LOG4J2-1693
On Thu, Nov 10, 2016 at 5:15 PM, Matt Sicker wrote:
> 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:
>
> >
Would that help?
http://stackoverflow.com/questions/24179375/eclipse-rcp-java-lang-classnotfoundexception-a-runtime
in particular:
Bundle-ClassPath: .,lib/library.jar
On Tue, Nov 29, 2016 at 4:48 PM, Gary Gregory
wrote:
> OSGi and class loaders make for complications and tricky debugging sessio
Hello,
Is there a way to use TLS when sending emails through the SMTP appender?
https://logging.apache.org/log4j/2.x/manual/appenders.html#SMTPAppender
Thanks
Benjamin
Hello,
I am seeing logs that are not in order in the log file, it this expected
when using a RollingFile appender?
"appenders" : {
"appender" : [ {
"type" : "RollingFile",
"name" : "ServerAppender",
"PatternLayout" : {
"pattern" : "%d{-MM-dd HH:mm:ss,SS
e out of order in the same thread? That shouldn’t happen.
> >
> > Ralph
> >
> >> On Dec 14, 2017, at 3:09 PM, Benjamin Jaton
> wrote:
> >>
> >> Hello,
> >>
> >> I am seeing logs that are not in order in the log file, it t
Hello,
I would like to have a piece of code use Log4J2 to log events in a CSV
format. So the appender and logger configuration are specific to this task.
The problem is that there are several JVMs that might invoke this task (not
at the same time though). Therefore I would think that each of thos
erwise, you could also set the config file name system
> property to locate a common config file (at least through the local file
> system or class path).
>
> On Wed, Feb 7, 2018 at 18:01, Benjamin Jaton
> wrote:
>
> > Hello,
> >
> > I would like to have a piece
at 8:53 PM, Ralph Goers
wrote:
> Are you saying you want to merge a new configuration with the existing
> one? Log4j supports a composite configuration but the files that make up
> the composite have to be known from the beginning.
>
> Ralph
>
> > On Feb 7, 2018, at 6:22 PM,
ess plug) Every java main() method deserves http://picocli.info
>
> > On Dec 15, 2017, at 8:45, Benjamin Jaton
> wrote:
> >
> > Oh interesting. Well this one appender is not async but it is multi
> > threaded, so I think that explains it.
> > Useful to know about
ng log entries that are out of order in the same thread?
>
> (Shameless plug) Every java main() method deserves http://picocli.info
>
> > On Feb 21, 2018, at 7:15, Matt Sicker wrote:
> >
> > On 20 February 2018 at 11:32, Benjamin Jaton
> > wrote:
> >
> >
Hello,
Would anyone have an idea why the AsyncAppender ends up up in a blocked
state given the following stack:
Thread 20497: (state = BLOCKED)
- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information
may be imprecise)
- java.util.concurrent.locks.LockSupport.park(java.lang.Objec
Hello,
Several times I've been in a situation where in a given JVM I am trying to
run distinct jobs in separate threads, who themselves might spawn their own
threads.
In those situations I usually want the logging of each job in a separate
log file, and that has proven to be difficult.
Log4j2 has
the parent
> thread with its own thread group and use the thread group name in the
> lookup.
>
> Ralph
>
> > On Apr 23, 2019, at 5:06 PM, Benjamin Jaton
> wrote:
> >
> > Hello,
> >
> > Several times I've been in a situation where in a given JVM I
f the javadoc for Thread indicates the do by default.
>
> Ralph
>
> On Apr 23, 2019, at 10:12 PM, Benjamin Jaton
> wrote:
>
> >> If you want all the threads in a “job” then I would create the parent
> > thread with its own thread group and use the thread group name in
hin
> the execution of Thread 2 as this program only has a single thread of
> execution. Thread 2 and 3 are never started.
>
> In other words Thread 3 must be executed from the call stack of Thread 2’s
> run method while Thread 2 is in control of the execution.
>
> Ralph
>
in the majority of cases.
>
> Ralph
>
>
> > On Apr 24, 2019, at 1:53 PM, Benjamin Jaton
> wrote:
> >
> > Yes, indeed when I replace t1.run() with t1.start() it does output:
> > t1 threadgroup = mygroup
> > t2 threadgroup = mygroup
> > Tha
gt;>
> >> Matt, Benjamin’s issue is that he has no control over what is running
> in the “jobs” but he wants all the logs for a “job” to end up in the same
> appender. His definition of a job is that he is creating a thread to run it
> and everything under that thread should rou
gt; On Thu, 25 Apr 2019 at 13:35, Benjamin Jaton
> wrote:
> >
> > I've used ThresholdFilter to have the log level check at the level of the
> > (sub) appender:
> >
> > "ThresholdFilter": {
> >
> If you created a ThreadGroupContextSelector it probably would perform
> better, but you might be trading one set of problems for another.
>
> Ralph
>
> > On Apr 29, 2019, at 11:58 AM, Benjamin Jaton
> wrote:
> >
> > I ended up making a DynamicThreadholdFilter to be able to reso
60 matches
Mail list logo