Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-2234

Thrown Exception in shell commands should be logged as ERROR

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.1
    • Fix Version/s: 2.3.2, 2.4.0, 3.0.0
    • Component/s: karaf-shell
    • Labels:
    • Environment:

      Description

      If I remember correctly, the behavior in 2.3.0 was logging exceptions as ERROR. But for some reason, in 2.3.1 it is INFO. This makes it much harder to see/filter it in a flood of log messages.

      Example log:

      2013-03-12 17:29:49,784 | INFO  | l Console Thread | Console                          | araf.shell.console.jline.Console  198 | 14 - org.apache.karaf.shell.console - 2.3.1 | Exception caught while executing command
      java.lang.NullPointerException
              at id.co.bippo.salesorder.shell.hand.SalesOrderAddCommand.updateStockInventory(SalesOrderAddCommand.java:172)[302:id.co.bippo.salesorder.shell:5.0.0.SNAPSHOT]
              at id.co.bippo.salesorder.shell.hand.SalesOrderAddCommand.doExecute(SalesOrderAddCommand.java:152)[302:id.co.bippo.salesorder.shell:5.0.0.SNAPSHOT]
              at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[14:org.apache.karaf.shell.console:2.3.1]
              at org.soluvas.commons.shell.TenantCommandSupport.execute(TenantCommandSupport.java:55)[272:org.soluvas.commons:2.0.0.SNAPSHOT]
              at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.3.1]
              at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.3.1]
              at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.3.1]
              at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.3.1]
              at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.3.1]
              at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.3.1]
              at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.3.1]
              at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.3.1]
              at org.apache.karaf.shell.console.jline.Console.run(Console.java:174)[14:org.apache.karaf.shell.console:2.3.1]
              at java.lang.Thread.run(Thread.java:722)[:1.7.0_15]
      

      BTW I use Lilith during development, and it has a nice feature of showing error logs in big red color, so it's very easy to spot.

        Activity

        Hide
        jbonofre Jean-Baptiste Onofré added a comment - - edited

        This "regression" has been introduced by Christian in 1357297, to fix KARAF-1506. I'm fixing the log level issue.

        Show
        jbonofre Jean-Baptiste Onofré added a comment - - edited This "regression" has been introduced by Christian in 1357297, to fix KARAF-1506 . I'm fixing the log level issue.
        Hide
        jbonofre Jean-Baptiste Onofré added a comment -

        It's weird in your trace that we don't see the ShellUtil class involved.

        Do you use a custom distribution of Karaf ?

        Show
        jbonofre Jean-Baptiste Onofré added a comment - It's weird in your trace that we don't see the ShellUtil class involved. Do you use a custom distribution of Karaf ?
        Hide
        jbonofre Jean-Baptiste Onofré added a comment -

        More over, I think we should distinguish:

        • CommandException and CommandNotFoundException: it should be DEBUG or maybe WARN log level
        • other kind of Exception: it should be ERROR log level
        Show
        jbonofre Jean-Baptiste Onofré added a comment - More over, I think we should distinguish: CommandException and CommandNotFoundException: it should be DEBUG or maybe WARN log level other kind of Exception: it should be ERROR log level
        Show
        jbonofre Jean-Baptiste Onofré added a comment - Fixed on trunk: http://svn.apache.org/viewvc?view=revision&revision=1464952
        Show
        jbonofre Jean-Baptiste Onofré added a comment - Fixed on karaf-2.x: http://svn.apache.org/viewvc?view=revision&revision=1464980
        Show
        jbonofre Jean-Baptiste Onofré added a comment - Fixed on karaf-2.3.x: http://svn.apache.org/viewvc?view=revision&revision=1464999
        Hide
        ceefour Hendy Irawan added a comment -
        Show
        ceefour Hendy Irawan added a comment - Thank you Jean-Baptiste Onofré !

          People

          • Assignee:
            jbonofre Jean-Baptiste Onofré
            Reporter:
            ceefour Hendy Irawan
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development