How do I convert this log4j2.xml config fragment to log4j2.properties format?
I cannot use XML format in my maven + netbeans project as I simply cannot get log4j2 to parse and respond to a log4j2.xml file - no matter where I place it in my project, it is ignored by log4j2.
However log4j2.properties in main/resource IS parsed and responded to so I -HAVE- to use .properties...:
<JDBC name="databaseAppender" tableName="LOGGING.APPLICATION_LOG">
<ConnectionFactory class="log4j_tutorial.ConnectionFactory"
method="getDatabaseConnection" />
<Column name="EVENT_DATE" isEventTimestamp="true" />
<Column name="LEVEL" pattern="%level" />
<Column name="LOGGER" pattern="%logger" />
<Column name="MESSAGE" pattern="%message" />
<Column name="THROWABLE" pattern="%ex{full}" />
</JDBC>
I'm using log4j2 2.10.0 via the official Apache Maven log4j artifacts.
What would the -correct- log4j2.properties config be to be 100% equivalent to the above?
I'm close to spending two days straight just on getting a JDBC appender working, so it is time to ask for help, methinks.
My current log4j2.properties file which works fine an outputs to file and console:
appender.file.type = File
appender.file.name = fileAppender
appender.file.fileName = verdi.log
appender.file.layout.type = PatternLayout
appender.file.layout.pattern = %d{YYYY-mm-dd HH:mm:ss.SSS} %-5p %c{1} - %m %n
appender.out.type = Console
appender.out.name = out
appender.out.layout.type = PatternLayout
appender.out.layout.pattern = %d{YYYY-mm-dd HH:mm:ss.SSS} %-5p %c{1} - %m %n
rootLogger.level = INFO
rootLogger.appenderRef.file.ref = fileAppender
rootLogger.appenderRef.out.ref = out
I literally just want to add a JDBC appender in the log4j2.properties file - the db table is already created, and I've implemented the ConnectionSource interface as per the docs, and it is backed by a connectionpooled DataSource, as per the docs. The official Apache docs however are very vague and extremely sparse with exact specifics especially as regards configuration.
I can find no official list of what elements should be in a JDBC appender when specified, and how the XML hierarchy apparent in the above must be specified in a log4j2.properties file. All examples I can find of JDBC appender configuration are -ALWAYS- log4j2.xml / XML based examples only.
Or should I give up and rather spend a few days / weeks trying to get log4j XML configuration working?
Thanks!