[
https://issues.apache.org/jira/browse/LOG4J2-1178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary Gregory updated LOG4J2-1178:
---------------------------------
Description:
I am writing a JDBC driver. The JDBC Spec has a a method
[DataSource.setLogWriter(PrintStream)|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-]
API drivers should implement.
Users can drop our driver into any tool that talks JDBC or write their own
apps. In am concerned about the 'drop the driver anywhere' scenario, like in an
Eclipse based tool; that may or may not use Eclipse DTP. Or anything else.
The
[setLogWriter()|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-]
API can be called at any time, after Log4j has initialized itself for example.
I do all my driver logging through Log4j. If a tool calls
[setLogWriter()|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-],
I'd like the given PrintStream to become an Appender such that Log4j output
appears there.
The only way I see to do that is through pseudo-code like
"getLoggerContext().getConfiguration().addAppender(PrintStreamAppender.createPrintStreamAppender(aPrintStream))"
I think that would need to be followed by a full reconfigure.
Can we use our new builder API to add to the current config and reconfigure?
This also applies to {{java.sql.DriverManager.setLogStream(PrintStream)}} and
{{java.sql.DriverManager.setLogWriter(PrintWriter)}}
was:
I am writing a JDBC driver. The JDBC Spec has a a method
[DataSource.setLogWriter(PrintStream)|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-]
API drivers should implement.
Users can drop our driver into any tool that talks JDBC or write their own
apps. In am concerned about the 'drop the driver anywhere' scenario, like in an
Eclipse based tool; that may or may not use Eclipse DTP. Or anything else.
The
[setLogWriter()|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-]
API can be called at any time, after Log4j has initialized itself for example.
I do all my driver logging through Log4j. If a tool calls
[setLogWriter()|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-],
I'd like the given PrintStream to become an Appender such that Log4j output
appears there.
The only way I see to do that is through pseudo-code like
"getLoggerContext().getConfiguration().addAppender(PrintStreamAppender.createPrintStreamAppender(aPrintStream))"
I think that would need to be followed by a full reconfigure.
Can we use our new builder API to add to the current config and reconfigure?
This also applies to {{java.sql.DriverManager.setLogStream(PrintStream)}}.
> Support use-case for JDBC's CommonDataSource.setLogWriter(PrintStream)
> ----------------------------------------------------------------------
>
> Key: LOG4J2-1178
> URL: https://issues.apache.org/jira/browse/LOG4J2-1178
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Environment: Apache Maven 3.3.3
> (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T04:57:37-07:00)
> Maven home: C:\Java\apache-maven-3.3.3\bin\..
> Java version: 1.7.0_79, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_79\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> Reporter: Gary Gregory
>
> I am writing a JDBC driver. The JDBC Spec has a a method
> [DataSource.setLogWriter(PrintStream)|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-]
> API drivers should implement.
> Users can drop our driver into any tool that talks JDBC or write their own
> apps. In am concerned about the 'drop the driver anywhere' scenario, like in
> an Eclipse based tool; that may or may not use Eclipse DTP. Or anything else.
> The
> [setLogWriter()|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-]
> API can be called at any time, after Log4j has initialized itself for
> example.
> I do all my driver logging through Log4j. If a tool calls
> [setLogWriter()|https://docs.oracle.com/javase/8/docs/api/javax/sql/CommonDataSource.html#setLogWriter-java.io.PrintWriter-],
> I'd like the given PrintStream to become an Appender such that Log4j output
> appears there.
> The only way I see to do that is through pseudo-code like
> "getLoggerContext().getConfiguration().addAppender(PrintStreamAppender.createPrintStreamAppender(aPrintStream))"
> I think that would need to be followed by a full reconfigure.
> Can we use our new builder API to add to the current config and reconfigure?
> This also applies to {{java.sql.DriverManager.setLogStream(PrintStream)}} and
> {{java.sql.DriverManager.setLogWriter(PrintWriter)}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]