Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-2331] Finer grained logging configuration #1895

Conversation

matkt
Copy link
Contributor

@matkt matkt commented Aug 30, 2019

PR description

Provide a way to enable logging for specific packages or classes. e.g. if my node isn't discovering peers I may want to see peer discovery at TRACE level but keep the Synchronizer at INFO level.

Request

{  
   "jsonrpc":"2.0",
   "method":"admin_changeLogLevel",
   "params":[  
      "DEBUG",
      [  
         "tech.pegasys.pantheon.ethereum.eth.manager",
         "tech.pegasys.pantheon.ethereum.p2p.rlpx.connections.netty.ApiHandler"
      ]
   ],
   "id":1
}

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "Success"
}

Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution - I suspect this will be very useful.

Configurator.setAllLevels("", logLevel);
final Optional<String[]> optionalLogFilters =
parameters.optional(request.getParams(), 1, String[].class);
optionalLogFilters.ifPresentOrElse(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting to use ifPresentOrElse is my favourite thing about now requiring Java 11. :)

@ajsutton ajsutton merged commit c679494 into PegaSysEng:master Sep 2, 2019
pscott pushed a commit to pscott/pantheon that referenced this pull request Sep 2, 2019
)

Allows setting the log level for specific packages or classes dynamically.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants