logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <amania...@apache.org>
Subject new catching syntax
Date Sun, 24 Aug 2014 08:31:57 GMT
Congratulations on the version 2 release. It looks great. A question though about the recommended
way to use the new 'catching syntax. We used to do this:

    catch (Exception e ) {
      logger.warn("Failed to import report: " + path, e);

But now the new lifecycle syntax has some advantages. We can do this:

    catch (Exception e ) {
      logger.catching(e);

But it would be useful for me to log the path which ultimately caused the exception. Except
that I cannot do this:

    catch (Exception e ) {
      logger.catching("Failed to import report: {}", path, e);


What is the recommended approach here? Avoid the lifecycle style syntax? Call the logger twice,
once with my message and variable and once with the exception?


Thanks
Ari


-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message