Re: Main application uses log4j2-test.xml in Eclipse

2018-01-18 Thread Sverre Moe
How can I avoid Log4j using any test configuration when I am running
my application in Eclipse IDE?

my-api/src/test/resources/log4j2-test.xml
my-application/src/test/resources/log4j2-test.xml
my-application/src/main/resources/log4j2.xml

I am not running tests, but my main application, thus I do not want
log4j to use the test configuration in either my application or the
API.
I wonder if this is more an eclipse issue rather than a log4j issue.

I also have a Logging ConfigurationFactory implementation (with
similar configuration as in log4j2.xml), which I could use from
eclipse iDE to avoid it having to scan for a configuration file and
then choosing a test configuration.

/Sverre

2017-11-24 23:08 GMT+01:00 Sverre Moe :
> I am running the application in Eclipse. Perhaps it adds the test classpath,
> even though I am not running a test application.
> Does a programmatic configuration override log4j2-test configuration or any
> other file configuration? Because using my own ConfigurationFactory works
> and it doens't use the file configuration, in either src/main/resources or
> src/test/resources.
>
> 2017-11-24 19:04 GMT+01:00 Matt Sicker :
>>
>> Are you running your application using your main classpath or your test
>> classpath? It's a feature of log4j2 to use the test config first based on
>> typical classpath usage scenarios. If there's no way for you to run your
>> application without the test classpath, then you can set the config file
>> system property (log4j.configurationFile) to manually specify the path to
>> the file.
>>
>> On 23 November 2017 at 02:08, Sverre Moe  wrote:
>>
>> > Running my main application in Eclipse it is using the log4j2-test.xml
>> > configuration, and not the log4j2.xml configuration.
>> >
>> > src/main/resources/log4j2.xml
>> > src/test/resources/log4j2-test.xml
>> >
>> > I am not running a test application under src/test, but my main
>> > application
>> > under src/main/
>> > target/classes/log4j2.xml
>> > target/test-classes/log4j2-test.xml
>> >
>> > How do I avoid it using the log4j2-test.xml when running from Eclipse?
>> >
>> > With a programmatic configuration it does not pick the log4j2-text.xml.
>> >
>> > *My XML configuration:*
>> > 
>> >
>> > 
>> >
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > > > fileName="${sys:user.home}/.app/app.log"
>> > filePattern="app-%d{-MM-dd}-%i.log.gz"
>> > immediateFlush="false" append="false">
>> > 
>> > ${pattern}
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > > > additivity="false">
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> >
>> >
>> > /Sverre
>> >
>>
>>
>>
>> --
>> Matt Sicker 
>
>

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Main application uses log4j2-test.xml in Eclipse

2017-11-24 Thread Sverre Moe
I am running the application in Eclipse. Perhaps it adds the test
classpath, even though I am not running a test application.
Does a programmatic configuration override log4j2-test configuration or any
other file configuration? Because using my own ConfigurationFactory works
and it doens't use the file configuration, in either src/main/resources or
src/test/resources.

2017-11-24 19:04 GMT+01:00 Matt Sicker :

> Are you running your application using your main classpath or your test
> classpath? It's a feature of log4j2 to use the test config first based on
> typical classpath usage scenarios. If there's no way for you to run your
> application without the test classpath, then you can set the config file
> system property (log4j.configurationFile) to manually specify the path to
> the file.
>
> On 23 November 2017 at 02:08, Sverre Moe  wrote:
>
> > Running my main application in Eclipse it is using the log4j2-test.xml
> > configuration, and not the log4j2.xml configuration.
> >
> > src/main/resources/log4j2.xml
> > src/test/resources/log4j2-test.xml
> >
> > I am not running a test application under src/test, but my main
> application
> > under src/main/
> > target/classes/log4j2.xml
> > target/test-classes/log4j2-test.xml
> >
> > How do I avoid it using the log4j2-test.xml when running from Eclipse?
> >
> > With a programmatic configuration it does not pick the log4j2-text.xml.
> >
> > *My XML configuration:*
> > 
> >
> > 
> >
> > 
> > 
> > 
> > 
> > 
> > 
> >  > fileName="${sys:user.home}/.app/app.log"
> > filePattern="app-%d{-MM-dd}-%i.log.gz"
> > immediateFlush="false" append="false">
> > 
> > ${pattern}
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >  > additivity="false">
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> >
> > /Sverre
> >
>
>
>
> --
> Matt Sicker 
>


Re: Main application uses log4j2-test.xml in Eclipse

2017-11-24 Thread Matt Sicker
Are you running your application using your main classpath or your test
classpath? It's a feature of log4j2 to use the test config first based on
typical classpath usage scenarios. If there's no way for you to run your
application without the test classpath, then you can set the config file
system property (log4j.configurationFile) to manually specify the path to
the file.

On 23 November 2017 at 02:08, Sverre Moe  wrote:

> Running my main application in Eclipse it is using the log4j2-test.xml
> configuration, and not the log4j2.xml configuration.
>
> src/main/resources/log4j2.xml
> src/test/resources/log4j2-test.xml
>
> I am not running a test application under src/test, but my main application
> under src/main/
> target/classes/log4j2.xml
> target/test-classes/log4j2-test.xml
>
> How do I avoid it using the log4j2-test.xml when running from Eclipse?
>
> With a programmatic configuration it does not pick the log4j2-text.xml.
>
> *My XML configuration:*
> 
>
> 
>
> 
> 
> 
> 
> 
> 
>  fileName="${sys:user.home}/.app/app.log"
> filePattern="app-%d{-MM-dd}-%i.log.gz"
> immediateFlush="false" append="false">
> 
> ${pattern}
> 
> 
> 
> 
> 
> 
> 
>  additivity="false">
> 
> 
> 
> 
> 
> 
> 
>
>
> /Sverre
>



-- 
Matt Sicker 


Main application uses log4j2-test.xml in Eclipse

2017-11-23 Thread Sverre Moe
Running my main application in Eclipse it is using the log4j2-test.xml
configuration, and not the log4j2.xml configuration.

src/main/resources/log4j2.xml
src/test/resources/log4j2-test.xml

I am not running a test application under src/test, but my main application
under src/main/
target/classes/log4j2.xml
target/test-classes/log4j2-test.xml

How do I avoid it using the log4j2-test.xml when running from Eclipse?

With a programmatic configuration it does not pick the log4j2-text.xml.

*My XML configuration:*












${pattern}

















/Sverre