Hi there

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?

Thanks

asked 28.10.2016 at 14:43

skilchenmann's gravatar image

skilchenmann
(suspended)
accept rate: 33%


It is possible via Log4j API. But not in the log4jconfig.xml as the logger name is dynamic.

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.

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);
        }
    }

}
link

answered 02.11.2016 at 12:25

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×28
×9

Asked: 28.10.2016 at 14:43

Seen: 2,117 times

Last updated: 02.11.2016 at 12:25