I want to create a new level(like INFO,ERROR) to use in xpertivy

asked 24.01.2014 at 08:07

toantp's gravatar image

accept rate: 0%

edited 18.02.2014 at 16:42

Flavio%20Sadeghi's gravatar image

Flavio Sadeghi ♦♦

Hi toantp This forum is for Xpert.ivy relevant questions only. Other questions will be delete in future. If you have very specific vietnam development questions that are not interessted for other users you can ask us directly via mail. Regards Reto Weiss, ivyTeam

(24.01.2014 at 17:34) Reto Weiss ♦♦ Reto%20Weiss's gravatar image

Xpert.ivy uses the standard logging library Log4J from Apache. For more information see the Log4J web page.


answered 24.01.2014 at 17:29

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
accept rate: 74%

Hi toantp

To add your own level try this:

  1. use the following code to create an own level.
  2. set the Priority value in the log4j.xml to your level name (here: "TEST")
  3. Use your new level: logger.log(TestLevel.Test, "Test output");
  4. If the entry does not show up in the log, alter the DEBUGINT between -100 and + 100

    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 && 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 && sArg.toUpperCase().equals("TEST")) {  
            return TEST;  
        return Level.toLevel(sArg,defaultLevel);  

answered 11.02.2014 at 16:55

Daniel%20Oechslin's gravatar image

Daniel Oechslin
accept rate: 39%

edited 11.02.2014 at 16:58

Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: 24.01.2014 at 08:07

Seen: 4,820 times

Last updated: 18.02.2014 at 16:42