Skip to main content

A command line tool for changing the logging level in JVM apps in runtime via Jolokia

Project description

# jloglevel

[![Build Status](](

`jloglevel` is a command line tool for changing the logging level in JVM apps in runtime via [Jolokia](

## How it works

JVM has a technology [Java Management Extensions (JMX)]( that allows to monitor and manage JVM applications in runtime. This is done via components called MBeans (managed beans). MBeans have attributes that can be read and operations (methods) that can be executed with JMX.

JVM logging libraries expose MBeans which apart from other features allow control of the logging level in runtime. That means that we can change the logging level of loggers inside the application without restart or modification of files.

JMX has a drawback: it doesn't go well with firewalls, especially in dynamic cloud environments. To overcome this issues, JMX-HTTP bridges exist, and [Jolokia]( is probably the most popular of them. It exposes JMX MBeans over HTTP and allows us to read attributes and call methods using simple GETs and POSTs.

Combining all this together, jloglevel makes it easy to get and set the logging level on a number of JVM applications (e.g. a scaled-out service).

Currently, only [Logback]( library is supported.

## Installation

$ pip3 install jloglevel

## Usage prerequisites

1. Jolokia agent needs to be attached to a JVM (or JVMs) you are going to work with. Follow the [Jolokia documentation]( for the details.

2. Logback must be configured to expose its control via JMX.
Technically only `<jmxConfigurator />` needs tp be added to `logback.xml`. See [JMX Configurator page]( in the documentation for the details.

## Usage

### Common options

There are two common options in every command:

`-h` or `--host` to specify the IP address and the port where Jolokia agent is listening for incoming connections. Can be multiple. _Example:_ `-h -h -h`

`--socks5` for specifying the SOCKS5 proxy IP address and port (if needed). _Example_: `--socks5`

This might be useful with SSH.

### Listing all loggers

To list the loggers use `list-loggers` command:

$ jloglevel list-loggers -h

### Getting the logging level

To get the logging levels use `get` command:

$ jloglevel get -h -h -h


By default, the logger is `ROOT`. You can get the logging level of another logger using `-l/--logger` option:

$ jloglevel get -h -l me.ivanyu.testapp.App

Logger me.ivanyu.testapp.App DEBUG

### Setting the logging level

To set the logging levels use `set` command:

$ jloglevel set -h -h -h TRACE


Starting from this moment, the logging level of the ROOT logger is `TRACE`.

As with `get` command, you can specify a logger different from the default `ROOT` using `-l/--logger` option:

$ jloglevel set -h -l me.ivanyu.testapp.App TRACE

Logger me.ivanyu.testapp.App OK

## Authors and Contributors

The project is started and maintained by [Ivan Yurchenko]( (

Contributions are welcome!

## License

Copyright 2017 Ivan Yurchenko

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jloglevel, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size jloglevel-0.1.4.tar.gz (8.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page