Hi Piotr,
Thanks for the response.
Yes. Below is the actual code which I am using to set the log level.
*Configurator.setlevel("com.thridparty",Level.DEBUG); *

I see this problem happens only on my wildfly deployment whereas it is
working in standalone mode. am using the  -Dlog4j.configurationFile
property and my log4j2.properties files and my log4j2.properties file looks
as

appenders = console,thirdparty
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy/MM/dd HH:mm:ss} %-5p [%c] %msg%n

appender.thirdparty.type = RollingFile
appender.thirdparty.name = Thirdparty
appender.thirdparty.fileName=${sys:jboss.server.base.dir}/thirdparty.log
appender.thirdparty.filePattern=
${sys:jboss.server.base.dir}/thirdparty.log.%i
appender.thirdparty.layout.type=PatternLayout
appender.thirdparty.layout.pattern=%d %-5p [%c] (%t) %msg%n
appender.thirdparty.policies.type = Policies
appender.thirdparty.policies.size.type = SizeBasedTriggeringPolicy
appender.thirdparty.policies.size.size=10KB
appender.thirdparty.strategy.type = DefaultRolloverStrategy
appender.thirdparty.strategy.fileIndex = min
appender.thirdparty.strategy.max = 8

logger.maverick.name=com.thridparty
logger.maverick.additivity=false
logger.maverick.appenderRefs = Thirdparty
logger.maverick.appenderRef.file.ref = Thirdparty

rootLogger.level = ERROR
rootLogger.appenderRefs = console
rootLogger.appenderRef.stdout.ref = STDOUT

However, What i noticed is, the Configurator.setLevel() method's
Logger.getContext has a different reference id whereas the actual class's
LoggerFactory.getLogger(class) has a different context id. I guess, because
of this, the update does not send the notification properly so that the
actual change is not reflected. Attached the snapshot, the first image is
for the level setting using *Configurator.setlevel(*) and the second image
is the actual class where actual logs are printed.
what i noticed is, when the

[image: image.png]

[image: image.png]


On Wed, Mar 23, 2022 at 10:52 PM Piotr P. Karwasz <piotr.karw...@gmail.com>
wrote:

> Hello Arulkumar,
>
> What method are you using to change the logger's level? The
> `Configurator.setLevel` methods are probably the most appropriate
> ones.
> Can you provide a minimal example of code that does not work?
>
> Piotr
>
> On Wed, 23 Mar 2022 at 06:43, Arulkumar Ponnusamy <parul....@gmail.com>
> wrote:
> >
> >  Hi all,
> > I am currently working on upgrading my log4j framework from 1.x to
> > 2.x(latest) and my application is deployed in the wildfly. As part of our
> > application, we provide the provision to change the log level at runtime.
> > Am facing a peculiar issue where the logging is working(changing the log
> > level) with the 2.17.1 version whereas the same is not working with
> 2.17.2.
> > The change of log level works only if you change it via log4j2.properties
> > files.
> >
> > any pointers on solving this would be great help
> > Thanks
> > Arulkumar Ponnusamy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>

Reply via email to