RE: AW: how to set log4j2 xml config location

2014-05-13 Thread zafer aydin
Hello Luigi, There is a problem at this line: l.getContext().start(cfg);Logger cannot contain any method named getContext. What can we use insead? Zafer AYDIN > From: luigi.al...@persis.de > To: log4j-user@logging.apache.org > Subject: AW: how to set log4j2 xml config location > Date: Tue, 13 M

Re: how to set log4j2 xml config location

2014-05-13 Thread Gary Gregory
Minor improvement: you can replace: LogManager.getLogger(LogManager.ROOT_LOGGER_NAME) with: LogManager.getRootLogger() Gary On Tue, May 13, 2014 at 4:15 AM, Luigi Alice wrote: > Load the file via InputStream: > > final ConfigurationFactory.ConfigurationSource source > =

Re: how to set log4j2 xml config location

2014-05-13 Thread Ralph Goers
While this works it would be better to use the Configurator class such as Configurator.intitalize(“MyContextName”, “myLog4j2.xml”); or final ConfigurationFactory.ConfigurationSource source = new ConfigurationFactory.ConfigurationSource(new ByteArrayInputStream(config.getBytes("UTF-8"))); Conf

AW: AW: how to set log4j2 xml config location

2014-05-13 Thread Luigi Alice
Yes, it has. Class: org.apache.logging.log4j.core.Logger -Ursprüngliche Nachricht- Von: zafer aydin [mailto:zafera...@hotmail.com] Gesendet: Dienstag, 13. Mai 2014 13:36 An: Log4J Users List Betreff: RE: AW: how to set log4j2 xml config location Hello Luigi, There is a problem at thi

RE: AW: AW: how to set log4j2 xml config location

2014-05-13 Thread zafer aydin
It works,Thank you. Zafer AYDIN > From: luigi.al...@persis.de > To: log4j-user@logging.apache.org > Subject: AW: AW: how to set log4j2 xml config location > Date: Tue, 13 May 2014 11:47:31 + > > Yes, it has. > > Class: > org.apache.logging.log4j.core.Logger > > > > -Ursprüngliche Na

Re: how to set log4j2 xml config location

2014-05-13 Thread Remko Popma
Take a look here: http://logging.apache.org/log4j/2.x/faq.html#config_location On Tue, May 13, 2014 at 2:20 PM, zafer aydin wrote: > Hello, > In my Java application, I created an xml configuration file named > "log4j2.xml" and put it under "Default Package". It works as expected.Now I > want to

AW: how to set log4j2 xml config location

2014-05-13 Thread Luigi Alice
Load the file via InputStream: final ConfigurationFactory.ConfigurationSource source = new ConfigurationFactory.ConfigurationSource(new ByteArrayInputStream(config.getBytes("UTF-8"))); XMLConfiguration cfg = new XMLConfiguration(source);