github.com/mhilton/juju-juju@v0.0.0-20150901100907-a94dd2c73455/cmd/juju/helptopics/logging.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package helptopics
     5  
     6  const Logging = `
     7  Juju has logging available for both client and server components. Most
     8  users' exposure to the logging mechanism is through either the 'debug-log'
     9  command, or through the log file stored on the bootstrap node at
    10  /var/log/juju/all-machines.log.
    11  
    12  All the agents have their own log files on the individual machines. So
    13  for the bootstrap node, there is the machine agent log file at
    14  /var/log/juju/machine-0.log.  When a unit is deployed on a machine,
    15  a unit agent is started. This agent also logs to /var/log/juju and the
    16  name of the log file is based on the id of the unit, so for wordpress/0
    17  the log file is unit-wordpress-0.log.
    18  
    19  Juju uses rsyslog to forward the content of all the log files on the machine
    20  back to the bootstrap node, and they are accumulated into the all-machines.log
    21  file.  Each line is prefixed with the source agent tag (also the same as
    22  the filename without the extension).
    23  
    24  Juju has a hierarchical logging system internally, and as a user you can
    25  control how much information is logged out.
    26  
    27  Output from the charm hook execution comes under the log name "unit".
    28  By default Juju makes sure that this information is logged out at
    29  the DEBUG level.  If you explicitly specify a value for unit, then
    30  this is used instead.
    31  
    32  Juju internal logging comes under the log name "juju".  Different areas
    33  of the codebase have different anmes. For example:
    34    providers are under juju.provider
    35    workers are under juju.worker
    36    database parts are under juju.state
    37  
    38  All the agents are started with all logging set to DEBUG. Which means you
    39  see all the internal juju logging statements until the logging worker starts
    40  and updates the logging configuration to be what is stored for the environment.
    41  
    42  You can set the logging levels using a number of different mechanisms.
    43  
    44  environments.yaml
    45   - all environments support 'logging-config' as a key
    46   - logging-config: ...
    47  environment variable
    48   - export JUJU_LOGGING_CONFIG='...'
    49  setting the logging-config at bootstrap time
    50   - juju bootstrap --logging-config='...'
    51  juju set-environment logging-config='...'
    52  
    53  Configuration values are separated by semicolons.
    54  
    55  Examples:
    56  
    57    juju set-environment logging-config "juju=WARNING; unit=INFO"
    58  
    59  Developers may well like:
    60  
    61    export JUJU_LOGGING_CONFIG='juju=INFO; juju.current.work.area=TRACE'
    62  
    63  Valid logging levels:
    64    CRITICAL
    65    ERROR
    66    WARNING
    67    INFO
    68    DEBUG
    69    TRACE
    70  `