<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: how to create a new level(like INFO,ERROR...) in log4j in Xpert ivy tool ?</title><link>https://answers.axonivy.com/questions/495/how-to-create-a-new-level-like-info-error-in-log4j-in-xpert-ivy-tool</link><description>&lt;p&gt;I want to create a new level(like INFO,ERROR) to use in xpertivy&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/495/how-to-create-a-new-level-like-info-error-in-log4j-in-xpert-ivy-tool" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 11 Feb 2014 16:55:25 -0500</lastBuildDate><item><title>Answer by Daniel Oechslin</title><link>https://answers.axonivy.com/questions/495/how-to-create-a-new-level-like-info-error-in-log4j-in-xpert-ivy-tool/518</link><description>&lt;p&gt;Hi toantp&lt;/p&gt;
&lt;p&gt;To add your own level try this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;use the following code to create an own level.&lt;/li&gt;
&lt;li&gt;set the Priority value in the log4j.xml to your level name (here: "TEST")&lt;/li&gt;
&lt;li&gt;Use your new level: logger.log(TestLevel.Test, "Test output");&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If the entry does not show up in the log, alter the DEBUGINT between -100 and + 100&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import org.apache.log4j.Level;

public class TestLevel extends Level {

 public static final int TEST_INT = DEBUG_INT + 1;

 public static final Level TEST = new TestLevel(TEST_INT, "TEST", 7);

 protected TestLevel(int arg0, String arg1, int arg2) {  
     super(arg0, arg1, arg2);

 }

 public static Level toLevel(String sArg) {  
     if (sArg != null &amp;amp;&amp;amp; sArg.toUpperCase().equals("TEST")) {  
         return TEST;  
     }  
     return (Level) toLevel(sArg, Level.DEBUG);  
 }

 public static Level toLevel(int val) {  
     if (val == TEST_INT) {  
         return TEST;  
     }  
     return (Level) toLevel(val, Level.DEBUG);  
 }

 public static Level toLevel(int val, Level defaultLevel) {  
     if (val == TEST_INT) {  
         return TEST;  
     }  
     return Level.toLevel(val,defaultLevel);  
 }

public static Level toLevel(String sArg, Level defaultLevel) {       
    if(sArg != null &amp;amp;&amp;amp; sArg.toUpperCase().equals("TEST")) {  
        return TEST;  
    }  
    return Level.toLevel(sArg,defaultLevel);  
    }  
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniel Oechslin</dc:creator><pubDate>Tue, 11 Feb 2014 16:55:25 -0500</pubDate><guid>https://answers.axonivy.com/questions/495/how-to-create-a-new-level-like-info-error-in-log4j-in-xpert-ivy-tool/518</guid></item><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/495/how-to-create-a-new-level-like-info-error-in-log4j-in-xpert-ivy-tool/503</link><description>&lt;p&gt;Xpert.ivy uses the standard logging library Log4J from Apache. For more information see the &lt;a href="http://logging.apache.org/log4j/1.2/"&gt;Log4J web page&lt;/a&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Fri, 24 Jan 2014 17:29:06 -0500</pubDate><guid>https://answers.axonivy.com/questions/495/how-to-create-a-new-level-like-info-error-in-log4j-in-xpert-ivy-tool/503</guid></item></channel></rss>