<commit_before># cadc-log

The `cadc-log` library provides a single servlet to initialize logging using
the log4j framework. The idea is to include this servlet in the web.xml with
`load-on-startup` of 1 (first) and configure standard logging there.

It is highly recommended that the default log level in web.xml be at `info` level.

Example:
```xml
<servlet>
    <servlet-name>logControl</servlet-name>
    <servlet-class>ca.nrc.cadc.log.LogControlServlet</servlet-class>
    <init-param>
      <param-name>logLevel</param-name>
      <param-value>info</param-value>
    </init-param>
    <init-param>
      <param-name>logLevelPackages</param-name>
      <param-value>
      <!-- whitespace separated list of packages for INFO level -->
        ca.nrc.cadc.auth
        ca.nrc.cadc.net
        ca.nrc.cadc.vosi
        ca.nrc.cadc.db
      </param-value>
    </init-param>
    <!-- optional hard coded group permission -->
    <init-param>
        <param-name>logAccessGroup</param-name>
        <param-value>ivo://cadc.nrc.ca/gms?CADC</param-value>
    </init-param>
    <init-param>
        <param-name>groupAuthorizer</param-name>
        <param-value>ca.nrc.cadc.ac.client.GroupAuthorizer</param-value>
    </init-param>
    <!-- optional runtime user and group permissions -->
    <init-param>
        <param-name>logControlProperties</param-name>
        <param-value>example-logControl.properties</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
```
The servlet will configure a default logging at `warn` level and the specified packages at
`info` level.

The LogControlServlet supports GET and POST requests to view and change the current log levels and/or
configured packages. This requires permission using either of the optional init params in the example
above. 

## example-logControl.properties<commit_msg>tweak README to recommend runtime config<commit_after># cadc-log

The `cadc-log` library provides a single servlet to initialize logging using
the log4j framework. The idea is to include this servlet in the web.xml with
`load-on-startup` of 1 (first) and configure standard logging there.

It is highly recommended that the default log level in web.xml be at `info` level.

Example:
```xml
<servlet>
    <servlet-name>logControl</servlet-name>
    <servlet-class>ca.nrc.cadc.log.LogControlServlet</servlet-class>
    <init-param>
      <param-name>logLevel</param-name>
      <param-value>info</param-value>
    </init-param>
    <init-param>
      <param-name>logLevelPackages</param-name>
      <param-value>
      <!-- whitespace separated list of packages for INFO level -->
        ca.nrc.cadc.auth
        ca.nrc.cadc.net
        ca.nrc.cadc.vosi
        ca.nrc.cadc.db
      </param-value>
    </init-param>
    <!-- optional hard coded group permission -->
    <init-param>
        <param-name>logAccessGroup</param-name>
        <param-value>ivo://cadc.nrc.ca/gms?CADC</param-value>
    </init-param>
    <init-param>
        <param-name>groupAuthorizer</param-name>
        <param-value>ca.nrc.cadc.ac.client.GroupAuthorizer</param-value>
    </init-param>
    <!-- optional runtime user and group permissions -->
    <init-param>
        <param-name>logControlProperties</param-name>
        <param-value>example-logControl.properties</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
```
The servlet will configure a default logging at `warn` level and the specified packages at
`info` level.

The LogControlServlet supports GET and POST requests to view and change the current log levels and/or
configured packages. This requires permission using either of the optional init params in the example
above. The latter runtime configuration of permissions is preferred because then configuration ends 
up in the config dir instead of hard coded inside the application (war file).

## example-logControl.properties
{'fraction_non_alphanumeric': 0.11522738886050077, 'fraction_numerical': 0.0015329586101175269, 'mean_word_length': 3.169329073482428, 'pattern_counts': {'":': 0, '<': 85, '<?xml version=': 0, '>': 85, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4395354', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1173, 'n_words': 334}