Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging options #54

Closed
ileasile opened this issue Apr 21, 2020 · 4 comments
Closed

Logging options #54

ileasile opened this issue Apr 21, 2020 · 4 comments
Labels

Comments

@ileasile
Copy link
Contributor

ileasile commented Apr 21, 2020

Logging in Kernel is not configurable now. It would be great to do something (or all) of the folllowing:

  1. Let the user specify default debug level via configuration file
  2. Let the user change log level via magic
  3. Swith off the logging when user works in console mode
  4. Let the user specify the file to redirect logs
@Stvad
Copy link

Stvad commented Jul 11, 2020

+1 to this the debug logging in console mode (which is the default) is very distracting.
Btw before making this configurable would it be possible to changed that default for the console?

@Stvad
Copy link

Stvad commented Jan 17, 2021

Are there any updates on this? console is not very usable with this configuration :(

@ileasile
Copy link
Contributor Author

ileasile commented Apr 2, 2021

Logging is now switched off in console mode (v. 0.9.0.14), log-changing magic was merged into master

@ileasile
Copy link
Contributor Author

ileasile commented Apr 7, 2021

As for now, you can configure logging in following ways:

  1. If you are installing from sources, configure logback.xml file before installation. For example, this is how you can add a file appender:
<configuration>
    <appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
        <!-- encoders are assigned the type
             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
        <target>System.err</target>
        <encoder>
            <pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
        </encoder>
    </appender>

    <appender name="file1" class="ch.qos.logback.core.FileAppender">
        <file>/home/user/log.txt</file>
        <encoder>
            <pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
        </encoder>
    </appender>

    <root level="DEBUG">
        <appender-ref ref="STDERR" />
        <appender-ref ref="file1" />
    </root>
</configuration>

Read more about logback configuration here

  1. You may change root logging level in runtime if you wish. Use %logLevel magic for this purpose:
%logLevel error

See more info about magics here

  1. Logging will be switched off on getting is_complete_request request. This request is sent only by console clients.
  2. You may use internal %logHandler magic for turning on log redirection in runtime. The behavior of this magic may be changed in future. Usage is following:

%logHandler list - lists all currently available appenders. By default, only console appender is available
%logHandler remove <name> - removes appender with the given name
%logHandler add <name> --file <path> - adds new file appender with name name which appends logs to the file path

If you need something else regarding logging, feel free to open new issue.

@ileasile ileasile closed this as completed Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants