cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

log4j.logger.de.my.package has no effect

Former Member
0 Likes
672

I have a custom Class with

 package de.my.package.messagesource.services.impl;
 
 private static final Logger LOG = Logger.getLogger(DefaultSystemResourceService.class);
 
 LOG.warn(new StringBuilder("SystemResource with code '").append(code).append("' not found!").toString());

Now i insert in hac:

log4j.appender.de.my.package.messagesource.services.impl=false log4j.logger.de.my.package.messagesource.services.impl=ERROR

But I still see the Outputs in Terminal. How can I avoid that?

Greatings David

Accepted Solutions (0)

Answers (2)

Answers (2)

arvind-kumar_avinash
Active Contributor
0 Likes

Please try the following configuration:

 log4j.logger.de.my.package.messagesource.services.impl=OFF

Also, please add it to local.properties file so that it can be loaded automatically on the next server restart.

geffchang
Active Contributor
0 Likes

If you are using the newer versions, the syntax is a bit different. It's like this:

 log4j2.logger.AnyLabel.name = org.apache.solr
 log4j2.logger.AnyLabel.level = ERROR
 log4j2.logger.AnyLabel.additivity = false
 log4j2.logger.AnyLabel.appenderRef.stdout.ref = STDOUT

You can change AnyLabel to anything you like.

Reference:

( If it works, don't forget to Upvote and Accept. )

For the old logger, this should work:

 log4j.rootLogger=INFO, CONSOLE
 log4j.appender.CONSOLE.layout.ConversionPattern=%-5p [%t] %X{RemoteAddr}%X{Tenant}%X{CronJob}[%C.%M:%L] %m%n
 log4j.logger.org.apache.solr=ERROR
Former Member
0 Likes

And the Old Log4J as in previous versions?

geffchang
Active Contributor
0 Likes

I've updated the answer for sample configuration for the old logging. Let me know if it works.

geffchang
Active Contributor
0 Likes

I just reread your question, and you said you put it in HAC. Try putting it in local.properties, and restarting the server.