<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Disable user_code logs on engine</title><link>https://answers.axonivy.com/questions/2151/disable-user_code-logs-on-engine</link><description>&lt;p&gt;Hi there&lt;/p&gt;
&lt;p&gt;we have lot of user_code logs within our projects and no time to remove them all. 
Is there an easy way to disable the user_code output to the logfile?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2151/disable-user_code-logs-on-engine" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 02 Nov 2016 12:25:53 -0400</lastBuildDate><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/2151/disable-user_code-logs-on-engine/2159</link><description>&lt;p&gt;It is possible via Log4j API. But not in the log4jconfig.xml as the logger name is dynamic. &lt;/p&gt;
&lt;p&gt;The following class does what you want. You could create an AutoStartEventBean which runs periodically to ensure that this code is executed after a server start and also if a new PMV was deployed.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import ch.ivyteam.di.restricted.DiCore;
import ch.ivyteam.ivy.application.IApplicationConfigurationManager;
import ch.ivyteam.ivy.application.IProcessModelVersion;
import ch.ivyteam.ivy.application.RuntimeLogCategory;
import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.log.Logger;

public class RuntimeLogMuter {

    public static void mute()
    {
        IApplicationConfigurationManager appManager = DiCore.getGlobalInjector().getInstance(IApplicationConfigurationManager.class);
        for(IProcessModelVersion pmv : appManager.getProcessModelVersions())
        {
            Logger log = pmv.getRuntimeLog(RuntimeLogCategory.USER);
            Ivy.log().warn("Muted logger "+log.getName());
            log.setLevel(Level.OFF);
        }
    }

}
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Wed, 02 Nov 2016 12:25:53 -0400</pubDate><guid>https://answers.axonivy.com/questions/2151/disable-user_code-logs-on-engine/2159</guid></item></channel></rss>