Betr: Re: JDBCAppender fails to pass connection URL string

2019-12-13 Thread Alban Hertroys
"Gary Gregory"  wrote on 2019-12-12 21:54:27:

> The more:
> 
> https://github.com/apache/logging-log4j2/tree/release-2.x/log4j-
> core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc
> 
> Gary


Thanks for the examples, much appreciated. It confirmed that I was 
probably doing things correctly on the log4j front, at least.

As it turns out, the problem was with Tomcat's documentation about how to 
set up a JNDI connection. They refer to a META-INF/context.xml file in the 
web-app directory, but in our case the context files are located in the 
${CATALINA_OUT}/conf/Catalina/localhost directory and point to the 
locations where the web-app files can be found. Placing the  there got us rid of the error about the empty jdbc URL and driver 
name, at least.

I'm almost there. I can select from the database with a slightly expanded 
variation on my previous Java class, so we are able to connect at least - 
now to figure out why the actual webapp is not logging anything...

Should be easy enough to add a log4j JDBCAppender for my test-webapp.

> On Thu, Dec 12, 2019 at 3:54 PM Gary Gregory  
wrote:
> 
> > On Thu, Dec 12, 2019 at 9:55 AM Ralph Goers 

> > wrote:
> >
> >> I just looked at the JDBC unit tests and surprisingly didn’t see any 
that
> >> use a configuration file.
> >>
> >
> > Here is a 'fancy' example (the kind of stuff I use at work):
> >
> >
> > https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-
> jdbc-dbcp2/src/test/resources/log4j2-jdbc-dbcp2.xml
> >
> > Here are some more:
> >
> > ;-)
> >
> > Gary


This is what now remains of the configuration.

${CATALINA_OUT}/conf/Catalina/localhost/mywebapp_context.xml
> >>  -
> >>  
> >>  
> >>  >> name="jdbc/loggingtst"
> >> auth="Container"
> >> type="javax.sql.DataSource"
> >> username="*"
> >> password="*"
> >> driverClassName="org.postgresql.Driver"
> >> url="jdbc:postgresql://foobar:5432/logging-tst"
> >> maxTotal="20"
> >> maxIdle="10"
> >> />
> >>  
> >> 
> >> 
> >>  WEB-INF/classes/log4j2.xml:
> >>  ---
> >>  
> >>  
> >> ...
> >> 
> >> ...
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> ...
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >> 
> >>  
> >> 



Alban  Hertroys 
D: +31 (0)53 4 888 888  | T: +31 (0)53 4888 888 | E: 
alban.hertr...@apollovredestein.com
Apollo Vredestein B.V.| Ir. E.L.C. Schiffstraat 370, 7547 RD Enschede, The 
Netherlands
Chamber of Commerce number: 34223268

 

 
The information contained in this e-mail is intended solely for the use of the 
individual or entity to whom it is addressed. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution 
or action in relation to the contents of this information is strictly 
prohibited and may be unlawful and request you to delete this message and any 
attachments and advise the sender by return e-mail. The confidentiality of this 
message is not warranted. Apollo Vredestein and its subsidiaries rule out any 
and every liability resulting from this or any other electronic transmission





   Please consider the environment before printing this e-mail


Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Gary Gregory
On Thu, Dec 12, 2019 at 9:55 AM Ralph Goers 
wrote:

> I just looked at the JDBC unit tests and surprisingly didn’t see any that
> use a configuration file.
>

Here is a 'fancy' example (the kind of stuff I use at work):

https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-jdbc-dbcp2/src/test/resources/log4j2-jdbc-dbcp2.xml

Here are some more:

;-)

Gary


>
> Ralph
>
> > On Dec 12, 2019, at 7:54 AM, Matt Sicker  wrote:
> >
> > Unit tests in the log4j project. All our components have examples in unit
> > tests.
> >
> > On Thu, Dec 12, 2019 at 04:26 Alban Hertroys <
> > alban.hertr...@apollovredestein.com> wrote:
> >
> >> "Gary Gregory"  wrote on 2019-12-11 22:01:54:
> >>
> >>> CAUTION : External email. Do not click links or open  attachments
> >>> unless you recognize the sender and know the content is safe.
> >>>
> >>> AFK, sorry for the top-post. Have you looked at our unit tests? There
> >> might
> >>> be something there to help see what the usage pattern is for JNDI.
> >>
> >> You mean to say I should write some Java code to test the JNDI
> connection
> >> as defined in the Tomcat configuration? Or are the unit tests you refer
> to
> >> existing code that is available somewhere?
> >>
> >> Either way, I have no idea which unit tests you're referring to? I'm
> also
> >> not quite sure what I'm looking for here, I haven't done this before
> and I
> >> don't write Java code on a regular basis. Just created a few snippets to
> >> do small stuff here and there, such as this case where we're wrapping a
> >> servlet to have some logging of HTTP context information to a database
> >> table.
> >>
> >> There's no requirement here to do the logging through JNDI either; we
> used
> >> a direct connection through log4j.xml previously and that had some
> issues
> >> (mostly losing connection when the DB server got kicked). JNDI just
> seemed
> >> to be the easiest way to set up a connection pool for the JDBCAppender,
> >> but now it's starting to look like JNDI is anything but.
> >>
> >> Regards,
> >> Alban.
> >>
> >>
> >>> On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
> >>> alban.hertr...@apollovredestein.com> wrote:
> >>>
>  Hi,
> 
>  We're having a lot of trouble getting the JDBCAppender to write to our
>  PostgreSQL database. There's probably a configuration error somewhere,
> >> but
>  we haven't been able to find it. And I have been searching and trying
> >> for
>  several days now, with no progress at all.
>  Even though we specify a connection URL in the JDNI source (see
> >> below), it
>  always ends with the JDBCAppender complaining that:
> java.sql.SQLException: Cannot create JDBC driver of class ''
> >> for
>  connect URL 'null'
> 
>  The Appender should write the data to our database at server "foobar",
>  database "logging-tst". Using the same credentials in SquirrelSQL,
> >> with
>  the same JDBC driver, I can connect to that database and query the
> >> table
>  specified in the log4j.xml (schema: "logging", table: "usage"; names
> >> being
>  case-insensitive).
> 
>  Any pointers would be appreciated.
> 
>  Environment:
>  - Centos 7
>  - Apache Tomcat 8.5.32
>  - log4j-2.11
> 
>  We created a servlet HTTP filter into a JAR, compiled against:
>  WEB-INF/lib:
> log4j-api-2.11.0.jar  log4j-core-2.11.0.jar
> servlet-api.jar
> 
>  This servlet put()'s certain fields into the ThreadContext, which we
> >> then
>  attempt to access through %X{...} in the log4j2.xml, appending those
>  fields as a
>  row to an existing table in our database.
>  We had this set-up working previously with log4j-1.something in an MS
> >> SQL
>  '05
>  DB, all on Windows 2003 server (which we are migrating away from due
> >> to
>  performance issues).
> 
>  Files within the web application:
>  WEB-INF/lib/
> log4j-1.2-api-2.11.0.jar  log4j-api-2.11.0.jar
>  log4j-core-2.11.0.jar  log4j-jcl-2.11.0.jar  log4j-jul-2.11.0.jar
>  log4j-slf4j-impl-2.11.0.jar  log4j-web-2.11.0.jar
> postgresql-jdbc.jar
> 
> 
>  META-INF/context.xml:
>  -
>  
>  
>  name="jdbc/loggingtst"
> auth="Container"
> type="javax.sql.DataSource"
> username="*"
> password="*"
> driverClassName="org.postgresql.Driver"
> url="jdbc:postgresql://foobar:5432/logging-tst"
> maxTotal="20"
> maxIdle="10"
> />
>  
> 
> 
>  WEB-INF/classes/log4j2.xml:
>  ---
>  
>  
> ...
> 
> ...
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Gary Gregory
The more:

https://github.com/apache/logging-log4j2/tree/release-2.x/log4j-core/src/test/resources/org/apache/logging/log4j/core/appender/db/jdbc

Gary


On Thu, Dec 12, 2019 at 3:54 PM Gary Gregory  wrote:

> On Thu, Dec 12, 2019 at 9:55 AM Ralph Goers 
> wrote:
>
>> I just looked at the JDBC unit tests and surprisingly didn’t see any that
>> use a configuration file.
>>
>
> Here is a 'fancy' example (the kind of stuff I use at work):
>
>
> https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-jdbc-dbcp2/src/test/resources/log4j2-jdbc-dbcp2.xml
>
> Here are some more:
>
> ;-)
>
> Gary
>
>
>>
>> Ralph
>>
>> > On Dec 12, 2019, at 7:54 AM, Matt Sicker  wrote:
>> >
>> > Unit tests in the log4j project. All our components have examples in
>> unit
>> > tests.
>> >
>> > On Thu, Dec 12, 2019 at 04:26 Alban Hertroys <
>> > alban.hertr...@apollovredestein.com> wrote:
>> >
>> >> "Gary Gregory"  wrote on 2019-12-11 22:01:54:
>> >>
>> >>> CAUTION : External email. Do not click links or open  attachments
>> >>> unless you recognize the sender and know the content is safe.
>> >>>
>> >>> AFK, sorry for the top-post. Have you looked at our unit tests? There
>> >> might
>> >>> be something there to help see what the usage pattern is for JNDI.
>> >>
>> >> You mean to say I should write some Java code to test the JNDI
>> connection
>> >> as defined in the Tomcat configuration? Or are the unit tests you
>> refer to
>> >> existing code that is available somewhere?
>> >>
>> >> Either way, I have no idea which unit tests you're referring to? I'm
>> also
>> >> not quite sure what I'm looking for here, I haven't done this before
>> and I
>> >> don't write Java code on a regular basis. Just created a few snippets
>> to
>> >> do small stuff here and there, such as this case where we're wrapping a
>> >> servlet to have some logging of HTTP context information to a database
>> >> table.
>> >>
>> >> There's no requirement here to do the logging through JNDI either; we
>> used
>> >> a direct connection through log4j.xml previously and that had some
>> issues
>> >> (mostly losing connection when the DB server got kicked). JNDI just
>> seemed
>> >> to be the easiest way to set up a connection pool for the JDBCAppender,
>> >> but now it's starting to look like JNDI is anything but.
>> >>
>> >> Regards,
>> >> Alban.
>> >>
>> >>
>> >>> On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
>> >>> alban.hertr...@apollovredestein.com> wrote:
>> >>>
>>  Hi,
>> 
>>  We're having a lot of trouble getting the JDBCAppender to write to
>> our
>>  PostgreSQL database. There's probably a configuration error
>> somewhere,
>> >> but
>>  we haven't been able to find it. And I have been searching and trying
>> >> for
>>  several days now, with no progress at all.
>>  Even though we specify a connection URL in the JDNI source (see
>> >> below), it
>>  always ends with the JDBCAppender complaining that:
>> java.sql.SQLException: Cannot create JDBC driver of class ''
>> >> for
>>  connect URL 'null'
>> 
>>  The Appender should write the data to our database at server
>> "foobar",
>>  database "logging-tst". Using the same credentials in SquirrelSQL,
>> >> with
>>  the same JDBC driver, I can connect to that database and query the
>> >> table
>>  specified in the log4j.xml (schema: "logging", table: "usage"; names
>> >> being
>>  case-insensitive).
>> 
>>  Any pointers would be appreciated.
>> 
>>  Environment:
>>  - Centos 7
>>  - Apache Tomcat 8.5.32
>>  - log4j-2.11
>> 
>>  We created a servlet HTTP filter into a JAR, compiled against:
>>  WEB-INF/lib:
>> log4j-api-2.11.0.jar  log4j-core-2.11.0.jar
>> servlet-api.jar
>> 
>>  This servlet put()'s certain fields into the ThreadContext, which we
>> >> then
>>  attempt to access through %X{...} in the log4j2.xml, appending those
>>  fields as a
>>  row to an existing table in our database.
>>  We had this set-up working previously with log4j-1.something in an MS
>> >> SQL
>>  '05
>>  DB, all on Windows 2003 server (which we are migrating away from due
>> >> to
>>  performance issues).
>> 
>>  Files within the web application:
>>  WEB-INF/lib/
>> log4j-1.2-api-2.11.0.jar  log4j-api-2.11.0.jar
>>  log4j-core-2.11.0.jar  log4j-jcl-2.11.0.jar  log4j-jul-2.11.0.jar
>>  log4j-slf4j-impl-2.11.0.jar  log4j-web-2.11.0.jar
>> postgresql-jdbc.jar
>> 
>> 
>>  META-INF/context.xml:
>>  -
>>  
>>  
>> > name="jdbc/loggingtst"
>> auth="Container"
>> type="javax.sql.DataSource"
>> username="*"
>> password="*"
>> driverClassName="org.postgresql.Driver"
>> url="jdbc:postgresql://foobar:5432/logging-tst"
>> maxTotal="20"
>> maxIdle="10"
>> />

Re: Betr: Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Ralph Goers
No, it doesn’t necessarily mean that.  Some of the unit tests configure things 
programmatically by directly calling the plugins.

If you look at the documentation you will see  and 
 as connection sources you can configure. You should try that. I 
don’t know why examples weren’t added to the doc of how to use them but they 
should be straightforward.

Ralph

> On Dec 12, 2019, at 9:20 AM, Alban Hertroys 
>  wrote:
> 
> "Ralph Goers"  wrote on 2019-12-12 16:00:02:
> 
>> http://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender <
>> http://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender
>>> does have sample configurations but there is not one with the 
>> configuration I would expect to use where you can specify the driver
>> class, user name and password.
> 
> 
> ...Hang on... Does that mean I'm using a feature from an untested code 
> path?
> 
> I'm created a dumbed down servlet with the same configuration files and it 
> looks like the context from InitialContext() is empty - that certainly 
> would explain the null database driver and the empty connection string.
> 
> 
> 
> I put the above under Tomcat with a small context-file in 
> ${CATALINA_HOME}/conf/Catalina/localhost and got the output:
> 
>Context contains 0 items.
> 
> So it would seem that either my context initialization in de attached Java 
> class is incorrect, or my context is set up incorrectly somehow.
> 
> When adding code to get the DB connection from a DataSource from that 
> context to that class, I get the same exception as the one I get in my 
> attempts to set up log4j2. I suspect that the problem is there, but have 
> no clue where to look.
> 
> Is it required to also set up the same JNDI resource in tomcat's 
> server.xml? I think I tried that, but I removed it as it didn't seem to 
> help and I don't like having definitions duplicated all over the place.
> 
> Regards,
> Alban.
> 
>>> On Dec 12, 2019, at 7:55 AM, Ralph Goers  
> wrote:
>>> 
>>> I just looked at the JDBC unit tests and surprisingly didn’t see 
>> any that use a configuration file.
>>> 
>>> Ralph
>>> 
 On Dec 12, 2019, at 7:54 AM, Matt Sicker  wrote:
 
 Unit tests in the log4j project. All our components have examples in 
> unit
 tests.
 
 On Thu, Dec 12, 2019 at 04:26 Alban Hertroys <
 alban.hertr...@apollovredestein.com> wrote:
 
> "Gary Gregory"  wrote on 2019-12-11 
> 22:01:54:
> 
>> CAUTION : External email. Do not click links or open  attachments
>> unless you recognize the sender and know the content is safe.
>> 
>> AFK, sorry for the top-post. Have you looked at our unit tests? 
> There
> might
>> be something there to help see what the usage pattern is for JNDI.
> 
> You mean to say I should write some Java code to test the JNDI 
> connection
> as defined in the Tomcat configuration? Or are the unit tests you 
> refer to
> existing code that is available somewhere?
> 
> Either way, I have no idea which unit tests you're referring to? I'm 
> also
> not quite sure what I'm looking for here, I haven't done this before 
> and I
> don't write Java code on a regular basis. Just created a few 
> snippets to
> do small stuff here and there, such as this case where we're 
> wrapping a
> servlet to have some logging of HTTP context information to a 
> database
> table.
> 
> There's no requirement here to do the logging through JNDI either; 
> we used
> a direct connection through log4j.xml previously and that had some 
> issues
> (mostly losing connection when the DB server got kicked). JNDI just 
> seemed
> to be the easiest way to set up a connection pool for the 
> JDBCAppender,
> but now it's starting to look like JNDI is anything but.
> 
> Regards,
> Alban.
> 
> 
>> On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
>> alban.hertr...@apollovredestein.com> wrote:
>> 
>>> Hi,
>>> 
>>> We're having a lot of trouble getting the JDBCAppender to write to 
> our
>>> PostgreSQL database. There's probably a configuration error 
> somewhere,
> but
>>> we haven't been able to find it. And I have been searching and 
> trying
> for
>>> several days now, with no progress at all.
>>> Even though we specify a connection URL in the JDNI source (see
> below), it
>>> always ends with the JDBCAppender complaining that:
>>>  java.sql.SQLException: Cannot create JDBC driver of class ''
> for
>>> connect URL 'null'
>>> 
>>> The Appender should write the data to our database at server 
> "foobar",
>>> database "logging-tst". Using the same credentials in SquirrelSQL,
> with
>>> the same JDBC driver, I can connect to that database and query the
> table
>>> specified in the log4j.xml (schema: "logging", table: "usage"; 
> names
> being
>>> case-insensitive).
>>> 
>>> Any pointers would be 

Betr: Betr: Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Alban Hertroys
Rats, the attachment got stripped. Here's the code:

/* vim: ts=4 sw=4 cindent
 */
import java.io.IOException;
import java.io.PrintWriter;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingEnumeration;
import javax.naming.NameClassPair;
import javax.naming.NamingException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/DataSourceExample")
public class DataSourceExample extends HttpServlet
{
private static final long serialVersionUID = 1L;

protected void doGet(
HttpServletRequest  request
,   HttpServletResponse response
)
throws ServletException, IOException
{
Context ctx = null;

try {
PrintWriter out = response.getWriter();
response.setContentType("text/plain");

ctx = new InitialContext();

try {
printCtx(ctx, out);
}
catch (NamingException e) {
out.println(e);
}
}
catch (NamingException e)   { e.printStackTrace(); }
finally {
try {
ctx.close();
}
catch (NamingException e) { 
System.out.println("Exception in closing context."); }
}
}

private void printCtx(Context ctx, PrintWriter out)
throws NamingException
{
NamingEnumeration list = ctx.list("");
int rows = 0;

for (;list.hasMore(); rows++) {
NameClassPair pair = list.next();
out.print(pair.getName() + " : ");
try {
out.print(ctx.lookup(pair.getName()));
}
catch (Exception e) {}
out.println("");
}

out.println("Context contains " + rows + " items.");
}
}

"Alban Hertroys"  wrote on 2019-12-12 
17:20:26:

> Van: "Alban Hertroys" 
> Aan: "Log4J Users List" 
> Datum: 2019-12-12 17:20
> Onderwerp: Betr: Re: JDBCAppender fails to pass connection URL string
> 
> CAUTION : External email. Do not click links or open  attachments 
> unless you recognize the sender and know the content is safe.
> 
> "Ralph Goers"  wrote on 2019-12-12 16:00:02:
> 
> > http://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender 
<
> > http://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender
> > > does have sample configurations but there is not one with the 
> > configuration I would expect to use where you can specify the driver
> > class, user name and password.
> 
> 
> ...Hang on... Does that mean I'm using a feature from an untested code 
> path?
> 
> I'm created a dumbed down servlet with the same configuration files and 
it 
> looks like the context from InitialContext() is empty - that certainly 
> would explain the null database driver and the empty connection string.
> 
> 
> 
> I put the above under Tomcat with a small context-file in 
> ${CATALINA_HOME}/conf/Catalina/localhost and got the output:
> 
> Context contains 0 items.
> 
> So it would seem that either my context initialization in de attached 
Java 
> class is incorrect, or my context is set up incorrectly somehow.
> 
> When adding code to get the DB connection from a DataSource from that 
> context to that class, I get the same exception as the one I get in my 
> attempts to set up log4j2. I suspect that the problem is there, but have 

> no clue where to look.
> 
> Is it required to also set up the same JNDI resource in tomcat's 
> server.xml? I think I tried that, but I removed it as it didn't seem to 
> help and I don't like having definitions duplicated all over the place.
> 
> Regards,
> Alban.
> 
> > > On Dec 12, 2019, at 7:55 AM, Ralph Goers 
 
> wrote:
> > > 
> > > I just looked at the JDBC unit tests and surprisingly didn’t see 
> > any that use a configuration file.
> > > 
> > > Ralph
> > > 
> > >> On Dec 12, 2019, at 7:54 AM, Matt Sicker  wrote:
> > >> 
> > >> Unit tests in the log4j project. All our components have examples 
in 
> unit
> > >> tes

Betr: Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Alban Hertroys
"Ralph Goers"  wrote on 2019-12-12 16:00:02:

> http://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender <
> http://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender
> > does have sample configurations but there is not one with the 
> configuration I would expect to use where you can specify the driver
> class, user name and password.


...Hang on... Does that mean I'm using a feature from an untested code 
path?

I'm created a dumbed down servlet with the same configuration files and it 
looks like the context from InitialContext() is empty - that certainly 
would explain the null database driver and the empty connection string.



I put the above under Tomcat with a small context-file in 
${CATALINA_HOME}/conf/Catalina/localhost and got the output:

Context contains 0 items.

So it would seem that either my context initialization in de attached Java 
class is incorrect, or my context is set up incorrectly somehow.

When adding code to get the DB connection from a DataSource from that 
context to that class, I get the same exception as the one I get in my 
attempts to set up log4j2. I suspect that the problem is there, but have 
no clue where to look.

Is it required to also set up the same JNDI resource in tomcat's 
server.xml? I think I tried that, but I removed it as it didn't seem to 
help and I don't like having definitions duplicated all over the place.

Regards,
Alban.

> > On Dec 12, 2019, at 7:55 AM, Ralph Goers  
wrote:
> > 
> > I just looked at the JDBC unit tests and surprisingly didn’t see 
> any that use a configuration file.
> > 
> > Ralph
> > 
> >> On Dec 12, 2019, at 7:54 AM, Matt Sicker  wrote:
> >> 
> >> Unit tests in the log4j project. All our components have examples in 
unit
> >> tests.
> >> 
> >> On Thu, Dec 12, 2019 at 04:26 Alban Hertroys <
> >> alban.hertr...@apollovredestein.com> wrote:
> >> 
> >>> "Gary Gregory"  wrote on 2019-12-11 
22:01:54:
> >>> 
>  CAUTION : External email. Do not click links or open  attachments
>  unless you recognize the sender and know the content is safe.
>  
>  AFK, sorry for the top-post. Have you looked at our unit tests? 
There
> >>> might
>  be something there to help see what the usage pattern is for JNDI.
> >>> 
> >>> You mean to say I should write some Java code to test the JNDI 
connection
> >>> as defined in the Tomcat configuration? Or are the unit tests you 
refer to
> >>> existing code that is available somewhere?
> >>> 
> >>> Either way, I have no idea which unit tests you're referring to? I'm 
also
> >>> not quite sure what I'm looking for here, I haven't done this before 
and I
> >>> don't write Java code on a regular basis. Just created a few 
snippets to
> >>> do small stuff here and there, such as this case where we're 
wrapping a
> >>> servlet to have some logging of HTTP context information to a 
database
> >>> table.
> >>> 
> >>> There's no requirement here to do the logging through JNDI either; 
we used
> >>> a direct connection through log4j.xml previously and that had some 
issues
> >>> (mostly losing connection when the DB server got kicked). JNDI just 
seemed
> >>> to be the easiest way to set up a connection pool for the 
JDBCAppender,
> >>> but now it's starting to look like JNDI is anything but.
> >>> 
> >>> Regards,
> >>> Alban.
> >>> 
> >>> 
>  On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
>  alban.hertr...@apollovredestein.com> wrote:
>  
> > Hi,
> > 
> > We're having a lot of trouble getting the JDBCAppender to write to 
our
> > PostgreSQL database. There's probably a configuration error 
somewhere,
> >>> but
> > we haven't been able to find it. And I have been searching and 
trying
> >>> for
> > several days now, with no progress at all.
> > Even though we specify a connection URL in the JDNI source (see
> >>> below), it
> > always ends with the JDBCAppender complaining that:
> >   java.sql.SQLException: Cannot create JDBC driver of class ''
> >>> for
> > connect URL 'null'
> > 
> > The Appender should write the data to our database at server 
"foobar",
> > database "logging-tst". Using the same credentials in SquirrelSQL,
> >>> with
> > the same JDBC driver, I can connect to that database and query the
> >>> table
> > specified in the log4j.xml (schema: "logging", table: "usage"; 
names
> >>> being
> > case-insensitive).
> > 
> > Any pointers would be appreciated.
> > 
> > Environment:
> > - Centos 7
> > - Apache Tomcat 8.5.32
> > - log4j-2.11
> > 
> > We created a servlet HTTP filter into a JAR, compiled against:
> > WEB-INF/lib:
> >   log4j-api-2.11.0.jar  log4j-core-2.11.0.jar
> >   servlet-api.jar
> > 
> > This servlet put()'s certain fields into the ThreadContext, which 
we
> >>> then
> > attempt to access through %X{...} in the log4j2.xml, appending 
those
> > fields as a
> > row to an existing table 

Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Ralph Goers
http://logging.apache.org/log4j/2.x/manual/appenders.html#JDBCAppender 
 does 
have sample configurations but there is not one with the configuration I would 
expect to use where you can specify the driver class, user name and password.

Ralph

> On Dec 12, 2019, at 7:55 AM, Ralph Goers  wrote:
> 
> I just looked at the JDBC unit tests and surprisingly didn’t see any that use 
> a configuration file.
> 
> Ralph
> 
>> On Dec 12, 2019, at 7:54 AM, Matt Sicker  wrote:
>> 
>> Unit tests in the log4j project. All our components have examples in unit
>> tests.
>> 
>> On Thu, Dec 12, 2019 at 04:26 Alban Hertroys <
>> alban.hertr...@apollovredestein.com> wrote:
>> 
>>> "Gary Gregory"  wrote on 2019-12-11 22:01:54:
>>> 
 CAUTION : External email. Do not click links or open  attachments
 unless you recognize the sender and know the content is safe.
 
 AFK, sorry for the top-post. Have you looked at our unit tests? There
>>> might
 be something there to help see what the usage pattern is for JNDI.
>>> 
>>> You mean to say I should write some Java code to test the JNDI connection
>>> as defined in the Tomcat configuration? Or are the unit tests you refer to
>>> existing code that is available somewhere?
>>> 
>>> Either way, I have no idea which unit tests you're referring to? I'm also
>>> not quite sure what I'm looking for here, I haven't done this before and I
>>> don't write Java code on a regular basis. Just created a few snippets to
>>> do small stuff here and there, such as this case where we're wrapping a
>>> servlet to have some logging of HTTP context information to a database
>>> table.
>>> 
>>> There's no requirement here to do the logging through JNDI either; we used
>>> a direct connection through log4j.xml previously and that had some issues
>>> (mostly losing connection when the DB server got kicked). JNDI just seemed
>>> to be the easiest way to set up a connection pool for the JDBCAppender,
>>> but now it's starting to look like JNDI is anything but.
>>> 
>>> Regards,
>>> Alban.
>>> 
>>> 
 On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
 alban.hertr...@apollovredestein.com> wrote:
 
> Hi,
> 
> We're having a lot of trouble getting the JDBCAppender to write to our
> PostgreSQL database. There's probably a configuration error somewhere,
>>> but
> we haven't been able to find it. And I have been searching and trying
>>> for
> several days now, with no progress at all.
> Even though we specify a connection URL in the JDNI source (see
>>> below), it
> always ends with the JDBCAppender complaining that:
>   java.sql.SQLException: Cannot create JDBC driver of class ''
>>> for
> connect URL 'null'
> 
> The Appender should write the data to our database at server "foobar",
> database "logging-tst". Using the same credentials in SquirrelSQL,
>>> with
> the same JDBC driver, I can connect to that database and query the
>>> table
> specified in the log4j.xml (schema: "logging", table: "usage"; names
>>> being
> case-insensitive).
> 
> Any pointers would be appreciated.
> 
> Environment:
> - Centos 7
> - Apache Tomcat 8.5.32
> - log4j-2.11
> 
> We created a servlet HTTP filter into a JAR, compiled against:
> WEB-INF/lib:
>   log4j-api-2.11.0.jar  log4j-core-2.11.0.jar
>   servlet-api.jar
> 
> This servlet put()'s certain fields into the ThreadContext, which we
>>> then
> attempt to access through %X{...} in the log4j2.xml, appending those
> fields as a
> row to an existing table in our database.
> We had this set-up working previously with log4j-1.something in an MS
>>> SQL
> '05
> DB, all on Windows 2003 server (which we are migrating away from due
>>> to
> performance issues).
> 
> Files within the web application:
> WEB-INF/lib/
>   log4j-1.2-api-2.11.0.jar  log4j-api-2.11.0.jar
> log4j-core-2.11.0.jar  log4j-jcl-2.11.0.jar  log4j-jul-2.11.0.jar
> log4j-slf4j-impl-2.11.0.jar  log4j-web-2.11.0.jar
>   postgresql-jdbc.jar
> 
> 
> META-INF/context.xml:
> -
> 
> 
>      name="jdbc/loggingtst"
>   auth="Container"
>   type="javax.sql.DataSource"
>   username="*"
>   password="*"
>   driverClassName="org.postgresql.Driver"
>   url="jdbc:postgresql://foobar:5432/logging-tst"
>   maxTotal="20"
>   maxIdle="10"
>   />
> 
> 
> 
> WEB-INF/classes/log4j2.xml:
> ---
> 
> 
>   ...
>   
>   ...
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   
>   ...
>   
>   
>   
> 

Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Ralph Goers
I just looked at the JDBC unit tests and surprisingly didn’t see any that use a 
configuration file.

Ralph

> On Dec 12, 2019, at 7:54 AM, Matt Sicker  wrote:
> 
> Unit tests in the log4j project. All our components have examples in unit
> tests.
> 
> On Thu, Dec 12, 2019 at 04:26 Alban Hertroys <
> alban.hertr...@apollovredestein.com> wrote:
> 
>> "Gary Gregory"  wrote on 2019-12-11 22:01:54:
>> 
>>> CAUTION : External email. Do not click links or open  attachments
>>> unless you recognize the sender and know the content is safe.
>>> 
>>> AFK, sorry for the top-post. Have you looked at our unit tests? There
>> might
>>> be something there to help see what the usage pattern is for JNDI.
>> 
>> You mean to say I should write some Java code to test the JNDI connection
>> as defined in the Tomcat configuration? Or are the unit tests you refer to
>> existing code that is available somewhere?
>> 
>> Either way, I have no idea which unit tests you're referring to? I'm also
>> not quite sure what I'm looking for here, I haven't done this before and I
>> don't write Java code on a regular basis. Just created a few snippets to
>> do small stuff here and there, such as this case where we're wrapping a
>> servlet to have some logging of HTTP context information to a database
>> table.
>> 
>> There's no requirement here to do the logging through JNDI either; we used
>> a direct connection through log4j.xml previously and that had some issues
>> (mostly losing connection when the DB server got kicked). JNDI just seemed
>> to be the easiest way to set up a connection pool for the JDBCAppender,
>> but now it's starting to look like JNDI is anything but.
>> 
>> Regards,
>> Alban.
>> 
>> 
>>> On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
>>> alban.hertr...@apollovredestein.com> wrote:
>>> 
 Hi,
 
 We're having a lot of trouble getting the JDBCAppender to write to our
 PostgreSQL database. There's probably a configuration error somewhere,
>> but
 we haven't been able to find it. And I have been searching and trying
>> for
 several days now, with no progress at all.
 Even though we specify a connection URL in the JDNI source (see
>> below), it
 always ends with the JDBCAppender complaining that:
java.sql.SQLException: Cannot create JDBC driver of class ''
>> for
 connect URL 'null'
 
 The Appender should write the data to our database at server "foobar",
 database "logging-tst". Using the same credentials in SquirrelSQL,
>> with
 the same JDBC driver, I can connect to that database and query the
>> table
 specified in the log4j.xml (schema: "logging", table: "usage"; names
>> being
 case-insensitive).
 
 Any pointers would be appreciated.
 
 Environment:
 - Centos 7
 - Apache Tomcat 8.5.32
 - log4j-2.11
 
 We created a servlet HTTP filter into a JAR, compiled against:
 WEB-INF/lib:
log4j-api-2.11.0.jar  log4j-core-2.11.0.jar
servlet-api.jar
 
 This servlet put()'s certain fields into the ThreadContext, which we
>> then
 attempt to access through %X{...} in the log4j2.xml, appending those
 fields as a
 row to an existing table in our database.
 We had this set-up working previously with log4j-1.something in an MS
>> SQL
 '05
 DB, all on Windows 2003 server (which we are migrating away from due
>> to
 performance issues).
 
 Files within the web application:
 WEB-INF/lib/
log4j-1.2-api-2.11.0.jar  log4j-api-2.11.0.jar
 log4j-core-2.11.0.jar  log4j-jcl-2.11.0.jar  log4j-jul-2.11.0.jar
 log4j-slf4j-impl-2.11.0.jar  log4j-web-2.11.0.jar
postgresql-jdbc.jar
 
 
 META-INF/context.xml:
 -
 
 
>>>name="jdbc/loggingtst"
auth="Container"
type="javax.sql.DataSource"
username="*"
password="*"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://foobar:5432/logging-tst"
maxTotal="20"
maxIdle="10"
/>
 
 
 
 WEB-INF/classes/log4j2.xml:
 ---
 
 
...

...











...



 




 
 
 
 
 WEB-INF/web.xml:
 
  ...
  
PostgreSQL logging table
jdbc/loggingtst
javax.sql.DataSource
Container
  
  ...
 
 With this, catalina.out contains:
 
 2019-12-09 17:38:16,460 localhost-startStop-1 ERROR
>> JdbcDatabaseManager
 JdbcManager{name=FexAppender, bufferSize=0, tableName=logging.usage,
 

Re: Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Matt Sicker
Unit tests in the log4j project. All our components have examples in unit
tests.

On Thu, Dec 12, 2019 at 04:26 Alban Hertroys <
alban.hertr...@apollovredestein.com> wrote:

> "Gary Gregory"  wrote on 2019-12-11 22:01:54:
>
> > CAUTION : External email. Do not click links or open  attachments
> > unless you recognize the sender and know the content is safe.
> >
> > AFK, sorry for the top-post. Have you looked at our unit tests? There
> might
> > be something there to help see what the usage pattern is for JNDI.
>
> You mean to say I should write some Java code to test the JNDI connection
> as defined in the Tomcat configuration? Or are the unit tests you refer to
> existing code that is available somewhere?
>
> Either way, I have no idea which unit tests you're referring to? I'm also
> not quite sure what I'm looking for here, I haven't done this before and I
> don't write Java code on a regular basis. Just created a few snippets to
> do small stuff here and there, such as this case where we're wrapping a
> servlet to have some logging of HTTP context information to a database
> table.
>
> There's no requirement here to do the logging through JNDI either; we used
> a direct connection through log4j.xml previously and that had some issues
> (mostly losing connection when the DB server got kicked). JNDI just seemed
> to be the easiest way to set up a connection pool for the JDBCAppender,
> but now it's starting to look like JNDI is anything but.
>
> Regards,
> Alban.
>
>
> > On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
> > alban.hertr...@apollovredestein.com> wrote:
> >
> > > Hi,
> > >
> > > We're having a lot of trouble getting the JDBCAppender to write to our
> > > PostgreSQL database. There's probably a configuration error somewhere,
> but
> > > we haven't been able to find it. And I have been searching and trying
> for
> > > several days now, with no progress at all.
> > > Even though we specify a connection URL in the JDNI source (see
> below), it
> > > always ends with the JDBCAppender complaining that:
> > > java.sql.SQLException: Cannot create JDBC driver of class ''
> for
> > > connect URL 'null'
> > >
> > > The Appender should write the data to our database at server "foobar",
> > > database "logging-tst". Using the same credentials in SquirrelSQL,
> with
> > > the same JDBC driver, I can connect to that database and query the
> table
> > > specified in the log4j.xml (schema: "logging", table: "usage"; names
> being
> > > case-insensitive).
> > >
> > > Any pointers would be appreciated.
> > >
> > > Environment:
> > > - Centos 7
> > > - Apache Tomcat 8.5.32
> > > - log4j-2.11
> > >
> > > We created a servlet HTTP filter into a JAR, compiled against:
> > > WEB-INF/lib:
> > > log4j-api-2.11.0.jar  log4j-core-2.11.0.jar
> > > servlet-api.jar
> > >
> > > This servlet put()'s certain fields into the ThreadContext, which we
> then
> > > attempt to access through %X{...} in the log4j2.xml, appending those
> > > fields as a
> > > row to an existing table in our database.
> > > We had this set-up working previously with log4j-1.something in an MS
> SQL
> > > '05
> > > DB, all on Windows 2003 server (which we are migrating away from due
> to
> > > performance issues).
> > >
> > > Files within the web application:
> > > WEB-INF/lib/
> > > log4j-1.2-api-2.11.0.jar  log4j-api-2.11.0.jar
> > > log4j-core-2.11.0.jar  log4j-jcl-2.11.0.jar  log4j-jul-2.11.0.jar
> > > log4j-slf4j-impl-2.11.0.jar  log4j-web-2.11.0.jar
> > > postgresql-jdbc.jar
> > >
> > >
> > > META-INF/context.xml:
> > > -
> > > 
> > > 
> > >  > > name="jdbc/loggingtst"
> > > auth="Container"
> > > type="javax.sql.DataSource"
> > > username="*"
> > > password="*"
> > > driverClassName="org.postgresql.Driver"
> > > url="jdbc:postgresql://foobar:5432/logging-tst"
> > > maxTotal="20"
> > > maxIdle="10"
> > > />
> > > 
> > >
> > >
> > > WEB-INF/classes/log4j2.xml:
> > > ---
> > > 
> > > 
> > > ...
> > > 
> > > ...
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ...
> > > 
> > > 
> > > 
> > >
> > > 
> > > 
> > > 
> > > 
> > >
> > > 
> > >
> > >
> > > WEB-INF/web.xml:
> > > 
> > >   ...
> > >   
> > > PostgreSQL logging table
> > > jdbc/loggingtst
> > > javax.sql.DataSource
> > > Container
> > >   
> > >   ...
> > >
> > > With this, catalina.out contains:
> > >
> > > 2019-12-09 17:38:16,460 localhost-startStop-1 ERROR
> JdbcDatabaseManager
> > > JdbcManager{name=FexAppender, bufferSize=0, tableName=logging.usage,
> > > columnConfigs=[{ name=servername, layout=%X{servername}, literal=null,
> > > timestamp=false }, 

Re: Re: JDBCAppender fails to pass connection URL string

2019-12-12 Thread Alban Hertroys
"Gary Gregory"  wrote on 2019-12-11 22:01:54:

> CAUTION : External email. Do not click links or open  attachments 
> unless you recognize the sender and know the content is safe.
> 
> AFK, sorry for the top-post. Have you looked at our unit tests? There 
might
> be something there to help see what the usage pattern is for JNDI.

You mean to say I should write some Java code to test the JNDI connection 
as defined in the Tomcat configuration? Or are the unit tests you refer to 
existing code that is available somewhere?

Either way, I have no idea which unit tests you're referring to? I'm also 
not quite sure what I'm looking for here, I haven't done this before and I 
don't write Java code on a regular basis. Just created a few snippets to 
do small stuff here and there, such as this case where we're wrapping a 
servlet to have some logging of HTTP context information to a database 
table.

There's no requirement here to do the logging through JNDI either; we used 
a direct connection through log4j.xml previously and that had some issues 
(mostly losing connection when the DB server got kicked). JNDI just seemed 
to be the easiest way to set up a connection pool for the JDBCAppender, 
but now it's starting to look like JNDI is anything but.

Regards,
Alban.


> On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
> alban.hertr...@apollovredestein.com> wrote:
> 
> > Hi,
> >
> > We're having a lot of trouble getting the JDBCAppender to write to our
> > PostgreSQL database. There's probably a configuration error somewhere, 
but
> > we haven't been able to find it. And I have been searching and trying 
for
> > several days now, with no progress at all.
> > Even though we specify a connection URL in the JDNI source (see 
below), it
> > always ends with the JDBCAppender complaining that:
> > java.sql.SQLException: Cannot create JDBC driver of class '' 
for
> > connect URL 'null'
> >
> > The Appender should write the data to our database at server "foobar",
> > database "logging-tst". Using the same credentials in SquirrelSQL, 
with
> > the same JDBC driver, I can connect to that database and query the 
table
> > specified in the log4j.xml (schema: "logging", table: "usage"; names 
being
> > case-insensitive).
> >
> > Any pointers would be appreciated.
> >
> > Environment:
> > - Centos 7
> > - Apache Tomcat 8.5.32
> > - log4j-2.11
> >
> > We created a servlet HTTP filter into a JAR, compiled against:
> > WEB-INF/lib:
> > log4j-api-2.11.0.jar  log4j-core-2.11.0.jar
> > servlet-api.jar
> >
> > This servlet put()'s certain fields into the ThreadContext, which we 
then
> > attempt to access through %X{...} in the log4j2.xml, appending those
> > fields as a
> > row to an existing table in our database.
> > We had this set-up working previously with log4j-1.something in an MS 
SQL
> > '05
> > DB, all on Windows 2003 server (which we are migrating away from due 
to
> > performance issues).
> >
> > Files within the web application:
> > WEB-INF/lib/
> > log4j-1.2-api-2.11.0.jar  log4j-api-2.11.0.jar
> > log4j-core-2.11.0.jar  log4j-jcl-2.11.0.jar  log4j-jul-2.11.0.jar
> > log4j-slf4j-impl-2.11.0.jar  log4j-web-2.11.0.jar
> > postgresql-jdbc.jar
> >
> >
> > META-INF/context.xml:
> > -
> > 
> > 
> >  > name="jdbc/loggingtst"
> > auth="Container"
> > type="javax.sql.DataSource"
> > username="*"
> > password="*"
> > driverClassName="org.postgresql.Driver"
> > url="jdbc:postgresql://foobar:5432/logging-tst"
> > maxTotal="20"
> > maxIdle="10"
> > />
> > 
> >
> >
> > WEB-INF/classes/log4j2.xml:
> > ---
> > 
> > 
> > ...
> > 
> > ...
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ...
> > 
> > 
> > 
> >
> > 
> > 
> > 
> > 
> >
> > 
> >
> >
> > WEB-INF/web.xml:
> > 
> >   ...
> >   
> > PostgreSQL logging table
> > jdbc/loggingtst
> > javax.sql.DataSource
> > Container
> >   
> >   ...
> >
> > With this, catalina.out contains:
> >
> > 2019-12-09 17:38:16,460 localhost-startStop-1 ERROR 
JdbcDatabaseManager
> > JdbcManager{name=FexAppender, bufferSize=0, tableName=logging.usage,
> > columnConfigs=[{ name=servername, layout=%X{servername}, literal=null,
> > timestamp=false }, { name=fex, layout=%X{focexec}, literal=null,
> > timestamp=false }, { name=parameters, layout=%X{parameters}, 
literal=null,
> > timestamp=false }, { name=username, layout=%X{username}, literal=null,
> > timestamp=false }, { name=duration, layout=%X{duration}, literal=null,
> > timestamp=false }, { name=user_agent, layout=%X{user-agent}, 
literal=null,
> > timestamp=false }], columnMappings=[]} Could not perform database 
startup
> > operations: 

Re: JDBCAppender fails to pass connection URL string

2019-12-11 Thread Gary Gregory
AFK, sorry for the top-post. Have you looked at our unit tests? There might
be something there to help see what the usage pattern is for JNDI.

Gary

On Tue, Dec 10, 2019, 06:02 Alban Hertroys <
alban.hertr...@apollovredestein.com> wrote:

> Hi,
>
> We're having a lot of trouble getting the JDBCAppender to write to our
> PostgreSQL database. There's probably a configuration error somewhere, but
> we haven't been able to find it. And I have been searching and trying for
> several days now, with no progress at all.
> Even though we specify a connection URL in the JDNI source (see below), it
> always ends with the JDBCAppender complaining that:
> java.sql.SQLException: Cannot create JDBC driver of class '' for
> connect URL 'null'
>
> The Appender should write the data to our database at server "foobar",
> database "logging-tst". Using the same credentials in SquirrelSQL, with
> the same JDBC driver, I can connect to that database and query the table
> specified in the log4j.xml (schema: "logging", table: "usage"; names being
> case-insensitive).
>
> Any pointers would be appreciated.
>
> Environment:
> - Centos 7
> - Apache Tomcat 8.5.32
> - log4j-2.11
>
> We created a servlet HTTP filter into a JAR, compiled against:
> WEB-INF/lib:
> log4j-api-2.11.0.jar  log4j-core-2.11.0.jar
> servlet-api.jar
>
> This servlet put()'s certain fields into the ThreadContext, which we then
> attempt to access through %X{...} in the log4j2.xml, appending those
> fields as a
> row to an existing table in our database.
> We had this set-up working previously with log4j-1.something in an MS SQL
> '05
> DB, all on Windows 2003 server (which we are migrating away from due to
> performance issues).
>
> Files within the web application:
> WEB-INF/lib/
> log4j-1.2-api-2.11.0.jar  log4j-api-2.11.0.jar
> log4j-core-2.11.0.jar  log4j-jcl-2.11.0.jar  log4j-jul-2.11.0.jar
> log4j-slf4j-impl-2.11.0.jar  log4j-web-2.11.0.jar
> postgresql-jdbc.jar
>
>
> META-INF/context.xml:
> -
> 
> 
>  name="jdbc/loggingtst"
> auth="Container"
> type="javax.sql.DataSource"
> username="*"
> password="*"
> driverClassName="org.postgresql.Driver"
> url="jdbc:postgresql://foobar:5432/logging-tst"
> maxTotal="20"
> maxIdle="10"
> />
> 
>
>
> WEB-INF/classes/log4j2.xml:
> ---
> 
> 
> ...
> 
> ...
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ...
> 
> 
> 
>
> 
> 
> 
> 
>
> 
>
>
> WEB-INF/web.xml:
> 
>   ...
>   
> PostgreSQL logging table
> jdbc/loggingtst
> javax.sql.DataSource
> Container
>   
>   ...
>
> With this, catalina.out contains:
>
> 2019-12-09 17:38:16,460 localhost-startStop-1 ERROR JdbcDatabaseManager
> JdbcManager{name=FexAppender, bufferSize=0, tableName=logging.usage,
> columnConfigs=[{ name=servername, layout=%X{servername}, literal=null,
> timestamp=false }, { name=fex, layout=%X{focexec}, literal=null,
> timestamp=false }, { name=parameters, layout=%X{parameters}, literal=null,
> timestamp=false }, { name=username, layout=%X{username}, literal=null,
> timestamp=false }, { name=duration, layout=%X{duration}, literal=null,
> timestamp=false }, { name=user_agent, layout=%X{user-agent}, literal=null,
> timestamp=false }], columnMappings=[]} Could not perform database startup
> operations: java.sql.SQLException: Cannot create JDBC driver of class ''
> for connect URL 'null' java.sql.SQLException: Cannot create JDBC driver of
> class '' for connect URL 'null'
> at
>
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:2186)
> at
>
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2066)
> at
>
> org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1525)
> at
>
> org.apache.logging.log4j.core.appender.db.jdbc.DataSourceConnectionSource.getConnection(DataSourceConnectionSource.java:51)
> at
>
> org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.startupInternal(JdbcDatabaseManager.java:85)
> at
>
> org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager.startup(AbstractDatabaseManager.java:81)
> at
>
> org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender.start(AbstractDatabaseAppender.java:106)
> at
>
> org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:265)
> at
>
> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:547)
> at
> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:263)
> at
>
> 

RE: JDBCAppender problem

2010-09-05 Thread Yogesh Rao
Hi Aleksandar,

Had a quick look at the config and everything else, they do seem fine...

Can you do the following and get back ?

1. Connect to DB and try manually inserting a record using the username and id 
specified?
2. i see the table name as logs can you try changing this to LOGS.. some 
databases can be case sensitive.. i have worked on oracle and it isnt but this 
will atleast let us know remove a possibility.

Do let us know with your results.

Cheers!
-Yogesh



From: Aleksandar Stoisavljevic [a.stoisavlje...@levi9.com]
Sent: Saturday, September 04, 2010 5:31 AM
To: log4j-user@logging.apache.org
Subject: JDBCAppender problem

Hi all,

I have a requirement to put some logs from my application into DB. My app. is 
based on PostgreSQL 8.4, so this is the targeted database.

I have Maven2 Java project, and project pom.xml looks like this:

project xmlns=http://maven.apache.org/POM/4.0.0;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd;
  modelVersion4.0.0/modelVersion
  groupIdrs.in.staleksit.
learning/groupId
  artifactIdlog4j-jdbcappender/artifactId
  version0.0.1-SNAPSHOT/version

  properties
  maven.sources.version1.6/maven.sources.version
  maven.target.version1.6/maven.target.version

  log4j.version1.2.16/log4j.version
  /properties


  dependencyManagement
  dependencies
  dependency
groupIdlog4j/groupId
artifactIdlog4j/artifactId
version${log4j.version}/version
/dependency
dependency
groupIdpostgresql/groupId
artifactIdpostgresql/artifactId
version8.4-701.jdbc3/version
/dependency
  /dependencies
  /dependencyManagement

  dependencies
  dependency
   groupIdlog4j/groupId
   artifactIdlog4j/artifactId
  /dependency
dependency
   groupIdpostgresql/groupId
   artifactIdpostgresql/artifactId
/dependency
  /dependencies
  build
  plugins
  plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
source${maven.source.version}/source
target${maven.target.version}/target
encodingUTF-8/encoding
/configuration
  /plugin
  /plugins
  /build
/project

So You see I am using Log4j 1.2.16 and PostgreSQL 8.4 dependencies.

I have a Main class like this one:

package rs.in.staleksit.learning.log4j.jdbcappender;

import org.apache.log4j.Logger;

public class MainClass {

private static final Logger log = Logger.getLogger(MainClass.class);

/**
 * @param args
 */
public static void main(String[] args) {
log.info(main method ENTER);

log.info(main method LEAVE);
}
}

So this is just a sample, as proof of concept.

I've log4j.xml configuration like this:
?xml version=1.0 encoding=UTF-8?
!DOCTYPE log4j:configuration PUBLIC -//LOGGER 
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd;
log4j:configuration
appender name=STDOUT class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern
value=%d{ABSOLUTE} %5p %c{1}:%L - %m%n /
/layout
/appender
appender name=DB class=org.apache.log4j.jdbc.JDBCAppender
param name=URL value=jdbc:postgresql://localhost:5432/log4jtest/
param name=Driver value=org.postgresql.Driver/
param name=user value=postgres/
param name=password value=postgres/
param name=sql value=INSERT INTO logs (user_id, dated, logger, 
level, message) VALUES ('%x', to_timestamp('%d', '-MM-DD HH24:MI:SS,MS'), 
'%C', '%p', '%m')/
/appender
root
level value=DEBUG /
appender-ref ref=STDOUT/
appender-ref ref=DB/
/root
/log4j:configuration

And at last I have created log4jtest DB and one single table LOGS (script of DB 
creation follows).
CREATE TABLE LOGS (
USER_ID character varying(60) NOT NULL,
DATED date NOT NULL,
LOGGER character varying(50) NOT NULL,
LEVEL character varying(10) NOT NULL,
MESSAGE character varying(1000)
);

But when I invoke program start, I am getting following error:

13:41:33,409  INFO MainClass:20 - main method ENTER
log4j:ERROR Failed to excute sql
org.postgresql.util.PSQLException: ERROR: relation logs does not exist
  Position: 13
at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
at 

RE: JDBCAppender

2009-10-02 Thread Michael Erskine
 From: Green, Kay [mailto:kay.gr...@mckesson.com]
 WARNING: This version of JDBCAppender is very likely to be completely
 replaced in the future. Moreoever, it does not log exceptions.
 Does anyone know if this appender has been replaced or is in the process
 of being replaced?

Hi Kay,
People usually roll their own replacement JDBCAppender: it's a lot of hassle 
trying to create a one-size-fits-all database appender as everybody's 
requirements are different (I know because I've tried and failed :) ).

Regards,
Michael Erskine.

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: JDBCAppender configuration

2008-07-16 Thread Johannes Hoechstaedter

Michael Erskine schrieb:

The JDBCAppender is shoddy anyhow - write yourself a replacement. It's a
great way to learn about what makes a good Appender.



To follow up: what I tend to do is have a custom JDBC Appender that adds a small custom 
log entry object (with all interesting info from the LoggingEvent) to a limited sized 
BlockingDeque and immediately returns. I have a background daemon thread that waits on 
the queue and adds the info to the logging database. I have a simple Connection test and 
failure recovery mechanism and I've hooked in a simple purge statement that 
can be run every few hours to limit the size of the log table, and some magic 
configuration entries so I can do some cool things inside activateOptions().

I'd post the classes if I wasn't developing proprietary software under NDA (and 
it wasn't so specific to my projects), but it's pretty simple stuff -- I 
learned most of how Log4J works by stepping through the source in Eclipse.

Regards,
Michael Erskine.
  

Thank you Michael, thats the way I went, too, and it works.

cheers
Johannes

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JDBCAppender configuration

2008-07-16 Thread Johannes Hoechstaedter

Thorbjørn Ravn Andersen schrieb:

Johannes Hoechstaedter skrev  den 15-07-2008 16:20:

Hi everybody,

I am up to build a coocon webapplication, and I am using the 
JDBCAppender for logging. It works quite well. My only problem is, 
that when I switch on the loggin in debug mode, my application is as 
fast as a snail because of the heavy database traffic. How can I 
solve that? I need the debug mode, because on other modes like info or 
Without having used it, I would suspect that you have autocommit on 
(the default) on your JDBC-connection.


Yeah you are right, when you look into the sources, the JDBC-Appender 
commits by default.


cheers

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JDBCAppender configuration

2008-07-15 Thread Michael Erskine
Johannes Hoechstaedter [mailto:[EMAIL PROTECTED] wrote
 I am up to build a coocon webapplication, and I am using the
 JDBCAppender for logging. It works quite well. My only problem is, that
 when I switch on the loggin in debug mode, my application is as fast as
 a snail because of the heavy database traffic. How can I solve that? I
 need the debug mode, because on other modes like info or warn no
 interesting log events are logged. I want to log the database actions,
 so that it is possible to monitor all database changes by the
 application. I heard something about filter possibilities, but could not
 find any documentation. Do I need to write my own appender or logger?
 Which tutorial do you suggest?

Logging database actions to the database? I'd rethink what you're trying to 
achieve with the logs! Add a simple FileAppender or even ConsoleAppender to 
debug what your app is doing and set a threshold of INFO on your JDBCAppender.

The JDBCAppender is shoddy anyhow - write yourself a replacement. It's a great 
way to learn about what makes a good Appender.

Regards,
Michael Erskine.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JDBCAppender configuration

2008-07-15 Thread Michael Erskine

 The JDBCAppender is shoddy anyhow - write yourself a replacement. It's a
 great way to learn about what makes a good Appender.

To follow up: what I tend to do is have a custom JDBC Appender that adds a 
small custom log entry object (with all interesting info from the LoggingEvent) 
to a limited sized BlockingDeque and immediately returns. I have a background 
daemon thread that waits on the queue and adds the info to the logging 
database. I have a simple Connection test and failure recovery mechanism and 
I've hooked in a simple purge statement that can be run every few hours to 
limit the size of the log table, and some magic configuration entries so I can 
do some cool things inside activateOptions().

I'd post the classes if I wasn't developing proprietary software under NDA (and 
it wasn't so specific to my projects), but it's pretty simple stuff -- I 
learned most of how Log4J works by stepping through the source in Eclipse.

Regards,
Michael Erskine.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JDBCAppender configuration

2008-07-15 Thread Thorbjørn Ravn Andersen

Johannes Hoechstaedter skrev  den 15-07-2008 16:20:

Hi everybody,

I am up to build a coocon webapplication, and I am using the 
JDBCAppender for logging. It works quite well. My only problem is, 
that when I switch on the loggin in debug mode, my application is as 
fast as a snail because of the heavy database traffic. How can I solve 
that? I need the debug mode, because on other modes like info or 
Without having used it, I would suspect that you have autocommit on (the 
default) on your JDBC-connection.


--
 Thorbjørn

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JDBCAppender

2008-05-08 Thread Bender Heri
Have you attached the appender to any logger?
Heri

 -Original Message-
 From: Simonebernardi [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 08, 2008 12:12 PM
 To: log4j-user@logging.apache.org
 Subject: [SPAM (DNS Blacklist)] - JDBCAppender - Sending mail server
 found on list.dsbl.org
 
 
 Hi all,
 
 I have a problem with JDBCAppender. I wrote a configuration file, but 
 the table does not write anything and not give me any errors. why?
 
 appender name=JDBC class=org.apache.log4j.jdbc.JDBCAppender
param name=url 
 value=jdbc:mysql://localhost:3306/sicve_uel1/
  param name=dbclass value=com.mysql.jdbc.Driver/
  param name=username value=sicve/
  param name=password value=sicve/
  param name=sql value=INSERT INTO logtest (id, prio, 
 cat, thread, msg, layout_msg, throwable, ndc, mdc, mdc2, info,
   addon, the_date, the_time, the_timestamp, created_by) 
 VALUES (@INC@, '@PRIO@', '@CAT@', '@THREAD@', '@MSG@', '@LAYOUT:1@',
   '@THROWABLE@', '@NDC@', '@MDC:MyMDC@', '@MDC:MyMDC2@', 
 'info timestamp: @TIMESTAMP@', 'addon',
   cast ('@LAYOUT:3@' as date), cast ('@LAYOUT:4@' 
 as time), 
 cast ('@LAYOUT:3@ @LAYOUT:4@' as timestamp), 'me')/
 param name=buffer value=1/
param name=commit value=true/
param name=quoteReplace value=true/
param name=throwableMaxChars value=3000/
param name=layoutPartsDelimiter value=#-#/
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=[%t] 
 %m#-##-#%d{dd.MM.}#-#%d{HH:mm:ss}/
   /layout
 
  
   /appender
 
 
 Thank you
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JDBCAppender

2008-05-08 Thread Simonebernardi




Yes 

root
  
  appender-ref ref="JDBC"/
/root



Bender Heri ha scritto:

  Have you attached the appender to any logger?
Heri

  
  
-Original Message-
From: Simonebernardi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 08, 2008 12:12 PM
To: log4j-user@logging.apache.org
Subject: [SPAM (DNS Blacklist)] - JDBCAppender - Sending mail server
found on list.dsbl.org


Hi all,

I have a problem with JDBCAppender. I wrote a configuration file, but 
the table does not write anything and not give me any errors. why?

appender name="JDBC" class="org.apache.log4j.jdbc.JDBCAppender"
   param name="url" 
value="jdbc:mysql://localhost:3306/sicve_uel1"/
 param name="dbclass" value="com.mysql.jdbc.Driver"/
 param name="username" value="sicve"/
 param name="password" value="sicve"/
 param name="sql" value="INSERT INTO logtest (id, prio, 
cat, thread, msg, layout_msg, throwable, ndc, mdc, mdc2, info,
  addon, the_date, the_time, the_timestamp, created_by) 
VALUES (@INC@, '@PRIO@', '@CAT@', '@THREAD@', '@MSG@', '@LAYOUT:1@',
  '@THROWABLE@', '@NDC@', '@MDC:MyMDC@', '@MDC:MyMDC2@', 
'info timestamp: @TIMESTAMP@', 'addon',
  cast ('@LAYOUT:3@' as date), cast ('@LAYOUT:4@' 
as time), 
cast ('@LAYOUT:3@ @LAYOUT:4@' as timestamp), 'me')"/
param name="buffer" value="1"/
   param name="commit" value="true"/
   param name="quoteReplace" value="true"/
   param name="throwableMaxChars" value="3000"/
   param name="layoutPartsDelimiter" value="#-#"/
   layout class="org.apache.log4j.PatternLayout"
   param name="ConversionPattern" value="[%t] 
%m#-##-#%d{dd.MM.}#-#%d{HH:mm:ss}"/
  /layout

 
  /appender


Thank you

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  
  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  



-- 











  

  
  
   4IT  
   S.r.l.
 Simone Bernardi |  
   Junior Consultant  
  -
 Via Udine 30-36, 00161 Roma
  Phone  
   +39 06 97601680
 Mobile+39 320 5707692
 Fax+39 06 97601683
 [EMAIL PROTECTED]
  www.4it.it  

  

  

 Il presente
messaggio e gli eventuali allegati sono di natura confidenziale. 
Qualora vi fosse pervenuto per errore, vi preghiamo di cancellarlo
immediatamente dal vostro sistema e di avvisare il mittente.  
 Grazie. 
  
 This electronic
mail transmission and any accompanying attachments contain confidential
information. If you have received this communication in error, please
immediately delete the E-mail and either notify the sender. Thank you.
   
   
   





Re: JDBCAppender and DB passwords

2008-04-02 Thread Jacob Kjome


There's a couple ways.  Both involve referencing variables set externally. 
For instance...


${db.username}
${db.password)

You can make these variables available in one of two ways (only the first way 
below if you are using XML config)


1.  Set it as a system property.  e.g...  java -Ddb.username=[username] 
-Ddb.password=[password]


2.  You can manually configure using the PropertyConfigurator and pass in 
variables prior to calling configure() (can't recall the exact API to do this 
at the moment, but you can look it up).



I have't worked with the JDBCAppender much.  I wonder if you couldn't just 
give it a JNDI name of the DataSource it is supposed to use?  In that case, 
the above would be unnecessary.


Jake


On Wed, 2 Apr 2008 23:37:27 +1100
 Annie Lane [EMAIL PROTECTED] wrote:

Hi list,

I'm using log4j-1.2.14 and want to play with JDBCAppender. My main concern
is the fact that in my log4j.properties file I need to provide the username
and password details for the database connection.

How can I use JDBCAppender without having to put this information in my
.properties file?

Additionally, how might I inject a database connection from within my
application? Say I'm developing a JEE app which contains its own connection
pooling mechanisms etc.

Any help/advice would be very much appreciated.

Annie



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JDBCAppender with large message values

2006-12-19 Thread Mattias Andersson
Hi,

 Hi,

 I want to include the JDBCAppender as one of our appenders so that all
 error level messages will be written to a common database.  The problem is
 that the message content frequently contains a stack trace which is too
 large for the database column.  What I get right now is a row with the
 'message' column empty/null.

 I looked at extending JDBCAppender doAppend method, which would check the
 length of the message and truncate it after the first X bytes but the
 LogEvent doesn't provide getters so that I could create a different
 LogEvent with the truncated message.

 What I really want to be able to do is use a format modifier on the
 message column, something like %2048m
 to get the first 2k bytes for the column.

 Any suggestions on other ways to get this implemented?

Use SUBSTRING in the INSERT statment perhaps?

INSERT INTO LOG_MESSAGES(Message) VALUES(SUBSTRING('%m', 0, 2048))

Regards,
 /Mattias






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JDBCAppender with large message values

2006-12-19 Thread Mike Miller
Thanks for the suggestion, and it appears to work in most cases.  Now my
problem is this:

We have code on our client that sends logging calls to our server so
that we can include 'client logged errors' in our server log.  When we
log an exception using log.error(throwable) this goes across to the wire
to our server by passing the LoggingEvent as a parameter.  The throwable
gets wrapped in a ThrowableInformation class but the throwable variable
is listed as transient - as a result - when the LoggingEvent gets to my
server, the throwable is null!  

The ThrowableInformation class does have the string representation of
the stack trace in the 'rep' variable - is there any way for me to have
that data 'rendered' as the message???

It seems like I need to capture this on the client side and any
throwable needs to be converted to a string and have that string
rendered somehow???



-Original Message-
From: Mattias Andersson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 19, 2006 5:52 AM
To: Log4J Users List
Subject: Re: JDBCAppender with large message values

Hi,

 Hi,

 I want to include the JDBCAppender as one of our appenders so that all
 error level messages will be written to a common database.  The
problem is
 that the message content frequently contains a stack trace which is
too
 large for the database column.  What I get right now is a row with the
 'message' column empty/null.

 I looked at extending JDBCAppender doAppend method, which would check
the
 length of the message and truncate it after the first X bytes but the
 LogEvent doesn't provide getters so that I could create a different
 LogEvent with the truncated message.

 What I really want to be able to do is use a format modifier on the
 message column, something like %2048m
 to get the first 2k bytes for the column.

 Any suggestions on other ways to get this implemented?

Use SUBSTRING in the INSERT statment perhaps?

INSERT INTO LOG_MESSAGES(Message) VALUES(SUBSTRING('%m', 0, 2048))

Regards,
 /Mattias






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JDBCAppender to MS Access Database

2006-03-07 Thread duvelbier-tsmets
It should be doable with the OJDBC driver...
Slow and definitively not a smart idea ... IMHO but it should work

\T,
 
-- Any fool can write code that a computer can understand. 
Good programmers write code that humans can understand.
   Martin Fowler 
T. : +32 (0)2 742 05 94
M. : +32 (0)497 44 68 12
@  : [EMAIL PROTECTED]
Do you skype too ... ?

- Original Message 
From: Pitchko, John SCAN [EMAIL PROTECTED]
To: log4j-user@logging.apache.org
Sent: Monday, March 6, 2006 4:27:52 PM
Subject: JDBCAppender to MS Access Database

Hello,

I'm in the process of upgrading one of our archaic applications from VBA code 
embedded in a MS Access database to a more robust and better designed Java app. 
I'm only working on the first part at the moment and will be using the Log4J 
libray to handle my logging needs. My boss wants me to save all log messages to 
a table in the Access database, just like it is now.

I haven't had too much luck setting up the JDBCAppender to connect to the 
Access database. Does anyone know if this is possible?

Thanks.

John Pitchko
Programmer/Analyst
Marketing Application Support Team

Shell Canada Limited
Calgary, Alberta, Canada
Office:  CP1 -2450
Phone: (403) 692-5399
E-mail:  [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JDBCAppender replacement

2005-04-05 Thread James Stauffer
I don't know when it will be released.  Probably when it is ready. :-)

On Apr 5, 2005 11:26 AM, John Ferron [EMAIL PROTECTED] wrote:
 And when is 1.3 going to be a stable production release?
 
  [EMAIL PROTECTED] 4/5/2005 11:22:11 AM 
 1.3 has a replacement (DBAppender).
 
 On Apr 5, 2005 11:09 AM, John Ferron [EMAIL PROTECTED]
 wrote:
  I'm curious as to when the JDBCAppender class is slated to be
 replaced
  in the current implemenation of Log4j.  I saw that there is an
  implemention by  http://www.dankomannhaupt.de/projects/.  I was just
  curious as to what I should be using.  I would like to be using the
  log4j implemention but I saw in the API documentation that it might
 be
  replaced.  Please advise.
 
  John
 
 
 
 --
 James Stauffer
 Are you good? Take the test at http://www.livingwaters.com/good/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JDBCAppender replacement

2005-04-05 Thread Lenin David Lozano Argel
I guess that the choice is to use another JDBCAppender implementation. The 
JDBCAppender that comes with log4j does not use PreparedStatement, and this is 
a poor practice with JDBC.

Lenin David Lozano Argel
Analista Arquitectura Informtica
Gerencia de Desarrollo
Suramericana S.A.
Email: [EMAIL PROTECTED]
Tel: (+574)4355596, Medellin - Colombia 




-Mensaje original-
De: James Stauffer [mailto:[EMAIL PROTECTED]
Enviado el: Martes, 05 de Abril de 2005 11:45 a.m.
Para: Log4J Users List
Asunto: Re: JDBCAppender replacement


I don't know when it will be released.  Probably when it is ready. :-)

On Apr 5, 2005 11:26 AM, John Ferron [EMAIL PROTECTED] wrote:
 And when is 1.3 going to be a stable production release?
 
  [EMAIL PROTECTED] 4/5/2005 11:22:11 AM 
 1.3 has a replacement (DBAppender).
 
 On Apr 5, 2005 11:09 AM, John Ferron [EMAIL PROTECTED]
 wrote:
  I'm curious as to when the JDBCAppender class is slated to be
 replaced
  in the current implemenation of Log4j.  I saw that there is an
  implemention by  http://www.dankomannhaupt.de/projects/.  I was just
  curious as to what I should be using.  I would like to be using the
  log4j implemention but I saw in the API documentation that it might
 be
  replaced.  Please advise.
 
  John
 
 
 
 --
 James Stauffer
 Are you good? Take the test at http://www.livingwaters.com/good/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



La informacin adjunta es exclusiva para la persona a la cual se dirige este 
mensaje, la cual puede contener informacin confidencial y/o material 
privilegiado. Cualquier revisin, retransmisin, diseminacin o uso del 
mismo, as como cualquier accin que se tome respecto a la informacin 
contenida, por personas o entidades diferente al propsito original de las 
misma, es ilegal. Si usted recibe este mensaje por error, favor notifqueme y 
elimine ese material. 
Este mensaje y sus anexos han sido sometidos a programas antivirus, por lo cual 
consideramos se encuentra libre de virus o cualquier anomala que pueda 
afectar a terceros, sin embargo, el destinatario debe verificar con sus propias 
protecciones que ellos no estn afectados por virus u otros defectos, en cuyo 
caso, el remitente no asume responsabilidad alguna por el recibo, transmisin 
y uso de este material.

The information transmitted here within is sensitive information intended only 
for use of the individual or entity to which it is addresses. If the reader of 
this message is not the intended recipient, you are hereby notified that any 
review, retransmission, dissemination, distribution, copying or other use of, 
or taking of any action in reliance upon, this information is strictly 
prohibited. IF you have received this communication in error, please contact 
the sender and delete the material from your computer.
Viruses: The message and its attachments are considered to be free of any virus 
or other defect. Nevertheless, we advise the recipient to verify that the 
material is virus free. Suramericana is not responsible for any loss or damages 
arising out of the transmission, use or handling of this matrial.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JDBCAppender replacement

2005-04-05 Thread James Stauffer
I started on a version that used prepared statements (you can have the
code if you wish) but I ran into issues trying to keep it generic
because Oracle doesn't have generated keys.

On Apr 5, 2005 11:47 AM, Lenin David Lozano Argel
[EMAIL PROTECTED] wrote:
 I guess that the choice is to use another JDBCAppender implementation. The 
 JDBCAppender that comes with log4j does not use PreparedStatement, and this 
 is a poor practice with JDBC.
 
 Lenin David Lozano Argel
 Analista Arquitectura Informática
 Gerencia de Desarrollo
 Suramericana S.A.
 Email: [EMAIL PROTECTED]
 Tel: (+574)4355596, Medellin - Colombia
 
 -Mensaje original-
 De: James Stauffer [mailto:[EMAIL PROTECTED]
 Enviado el: Martes, 05 de Abril de 2005 11:45 a.m.
 Para: Log4J Users List
 Asunto: Re: JDBCAppender replacement
 
 
 I don't know when it will be released.  Probably when it is ready. :-)
 
 On Apr 5, 2005 11:26 AM, John Ferron [EMAIL PROTECTED] wrote:
  And when is 1.3 going to be a stable production release?
 
   [EMAIL PROTECTED] 4/5/2005 11:22:11 AM 
  1.3 has a replacement (DBAppender).
 
  On Apr 5, 2005 11:09 AM, John Ferron [EMAIL PROTECTED]
  wrote:
   I'm curious as to when the JDBCAppender class is slated to be
  replaced
   in the current implemenation of Log4j.  I saw that there is an
   implemention by  http://www.dankomannhaupt.de/projects/.  I was just
   curious as to what I should be using.  I would like to be using the
   log4j implemention but I saw in the API documentation that it might
  be
   replaced.  Please advise.
  
   John
  
  
 
  --
  James Stauffer
  Are you good? Take the test at http://www.livingwaters.com/good/
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 --
 James Stauffer
 Are you good? Take the test at http://www.livingwaters.com/good/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 La información adjunta es exclusiva para la persona a la cual se dirige este 
 mensaje, la cual puede contener información confidencial y/o material 
 privilegiado. Cualquier revisión, retransmisión, diseminación o uso del 
 mismo, así como cualquier acción que se tome respecto a la información 
 contenida, por personas o entidades diferente al propósito original de las 
 misma, es ilegal. Si usted recibe este mensaje por error, favor notifíqueme y 
 elimine ese material.
 Este mensaje y sus anexos han sido sometidos a programas antivirus, por lo 
 cual consideramos se encuentra libre de virus o cualquier anomalía que pueda 
 afectar a terceros, sin embargo, el destinatario debe verificar con sus 
 propias protecciones que ellos no están afectados por virus u otros defectos, 
 en cuyo caso, el remitente no asume responsabilidad alguna por el recibo, 
 transmisión y uso de este material.
 
 The information transmitted here within is sensitive information intended 
 only for use of the individual or entity to which it is addresses. If the 
 reader of this message is not the intended recipient, you are hereby notified 
 that any review, retransmission, dissemination, distribution, copying or 
 other use of, or taking of any action in reliance upon, this information is 
 strictly prohibited. IF you have received this communication in error, please 
 contact the sender and delete the material from your computer.
 Viruses: The message and its attachments are considered to be free of any 
 virus or other defect. Nevertheless, we advise the recipient to verify that 
 the material is virus free. Suramericana is not responsible for any loss or 
 damages arising out of the transmission, use or handling of this matrial.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JDBCAppender help

2005-02-09 Thread WYNIWYG MOUAWAD Philippe \(CAMPUS\)
http://www.dankomannhaupt.de/projects/

-Original Message-
From: Harper, Allen (AHARPER) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 09, 2005 6:42 PM
To: Log4J Users List
Subject: JDBCAppender help


Can anyone please send me an example using the current implementation of
the JDBCAppender class.

Please include everything I need to do a table entry, PatternLayout
strings, JDBCAppender
Setup etc.

Thanks much.

Al Harper

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JDBCAppender help

2005-02-09 Thread Harper, Allen \(AHARPER\)
Thank you!
Al
 

-Original Message-
From: WYNIWYG MOUAWAD Philippe (CAMPUS)
[mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 09, 2005 11:44 AM
To: Log4J Users List
Subject: RE: JDBCAppender help

http://www.dankomannhaupt.de/projects/

-Original Message-
From: Harper, Allen (AHARPER) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 09, 2005 6:42 PM
To: Log4J Users List
Subject: JDBCAppender help


Can anyone please send me an example using the current implementation of
the JDBCAppender class.

Please include everything I need to do a table entry, PatternLayout
strings, JDBCAppender Setup etc.

Thanks much.

Al Harper

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]