You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2023/02/23 17:32:56 UTC

[GitHub] [logging-log4j2] ppkarwasz commented on issue #1285: Identifiers, names, refs, nightmare docs, logging hell level 999

ppkarwasz commented on issue #1285:
URL: https://github.com/apache/logging-log4j2/issues/1285#issuecomment-1442170110

   @robozb,
   
   The identifiers in the properties format are almost useless. One of the last attempts to make the properties format more digestible (#733 and related issues) proposed to use them as default appender names, but the feature never made it out to the main code.
   
   Such a usage would be in line with what Log4j 1.x did, but is not coherent with other formats: most formats use the identifiers/keys/element names to indicate the plugin type. You can see it in Ralph's YAML example:
   
   ```lang-yaml
    appenders:
      Console:
        name: STDOUT
        PatternLayout:
          Pattern: "%m%n"
       File:
         name: FILE
         fileName: ${filename}
         bufferedIO: false
         PatternLayout:
           Pattern: "%d %p %C{1.} [%t] %m%n"
   ```
   
   The keys `Console`, `File` and `PatternLayout` associated to YAML objects are used as _default_ values for the missing `type` properties.
   
   We could probably implement something similar in the properties format:
   
   ```
   appender.Console.name = STDOUT
   appender.Console.PatternLayout.pattern = "%m%n"
   
   appender.File.name = FILE
   appender.File.fileName = ${filename}
   appender.File.bufferedIO = false
   appender.File.PatternLayout.pattern = %d %p %C{1.} [%t] %m%n
   ```
   
   However there isn't much to be done if multiple appenders of the same type are required. In the YAML format we currently support the following shorthand:
   
   ```lang-yaml
   Appenders:
     File:
       - name: FILE1
         fileName: file1.log
       - name: FILE2
         fileName: file2.log
   ```
   
   (i.e. for YAML arrays the default type is the key associated to the array). I don't think anything similar would be possible for the properties format.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org