Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1296

Compute hash value from exception stacks

    XMLWordPrintable

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 1.3.0-alpha0
    • logback-classic

    Description

      Comparing two stack traces can be somewhat painful if you want to check whether two errors are - or not - occurrences of the same error.

      This new feature aims at computing a hash (hexadecimal integer) for each individual error stack trace, and inline them in the stack trace and/or output it as an individual conversion word.

      Ex:

      #07e70d1e> com.xyz.MyApp$MyClient$MyClientException: An error occurred while getting the things
        at com.xyz.MyApp$MyClient.getTheThings(MyApp.java:26)
        at com.xyz.MyApp.test_logging(MyApp.java:16)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        ...
      Caused by: #393b506a> com.xyz.MyApp$HttpStack$HttpError: I/O error on GET request for http://dummy/things
        at com.xyz.MyApp$HttpStack.get(MyApp.java:40)
        at com.xyz.MyApp$MyClient.getTheThings(MyApp.java:24)
        ... 23 common frames omitted
      Caused by: #d6db326f> java.net.SocketTimeoutException: Read timed out
        at com.xyz.MyApp$HttpStack.get(MyApp.java:38)
        ... 24 common frames omitted

       

      Those hash will help you detect several occurrences of the same error, as it is highly probable that two errors with the same hash will be - indeed - occurrences of the same error.

      I've already open-sourced this feature in a separate library (see https://github.com/Orange-OpenSource/orange-mathoms-logging ).

      It is very useful (especially when indexing this hash into Elasticsearch, to track the error history, frequency, ...) and quite used internally at Orange, and I though it would be nice to contribute to Logback...

       

      An implementation proposal is ready in my GitHub account

      See: https://github.com/pismy/logback/tree/stack-hash

      Let me know if I should create a PR now or start a discussion about the design.

      Thanks,

      Pierre.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            pismy Pierre Smeyers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: