From: David Z. <wzh...@gm...> - 2009-02-10 22:45:09
|
Hi there, Here is my log4perl.properties file setup for Log::Log4perl::Appender::DBI log4perl.appender.DBAppender = Log::Log4perl::Appender::DBI log4perl.appender.DBAppender.datasource = DBI:mysql:dbname=tmp;host=devserv;port= log4perl.appender.DBAppender.username = user log4perl.appender.DBAppender.password = 12345 log4perl.appender.DBAppender.sql = \ INSERT INTO spp (loglevel, message) \ VALUES (?,?) log4perl.appender.DBAppender.layout = Log::Log4perl::Layout::NoopLayout log4perl.appender.DBAppender.params.1 = %c log4perl.appender.DBAppender.params.1 = %m and got an error Log4perl: DBI appender failed to reconnect to database after 1 attempt at ./test.pl line 37 Please help, thanks in advance! David |
From: Mike S. <m...@pe...> - 2009-02-11 07:59:57
|
On Tue, 10 Feb 2009, David Zhao wrote: > = DBI:mysql:dbname=tmp;host=devserv;port= > log4perl.appender.DBAppender.username = user > log4perl.appender.DBAppender.password = 12345 Can you connect to the database using the mysql client? Try mysql -uuser -p -h devserv tmp and when prompted for a password, type '12345'. If this works, the only other suspicious item I noticed at first glance is the ";port=" part -- try it without. -- Mike Mike Schilli m...@pe... > log4perl.appender.DBAppender.sql = \ INSERT INTO spp (loglevel, > message) \ VALUES (?,?) log4perl.appender.DBAppender.layout > = Log::Log4perl::Layout::NoopLayout > log4perl.appender.DBAppender.params.1 = %c > log4perl.appender.DBAppender.params.1 = %m > > and got an error > Log4perl: DBI appender failed to reconnect to database after 1 attempt at > ./test.pl line 37 > > Please help, thanks in advance! > > David > > > ------------------------------------------------------------------------------ > Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) > software. With Adobe AIR, Ajax developers can use existing skills and code to > build responsive, highly engaging applications that combine the power of local > resources and data with the reach of the web. Download the Adobe AIR SDK and > Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > |
From: DavidZ <wei...@gm...> - 2009-02-11 19:07:13
|
yes, I can connect to the database using mysql client, and tried to connect without ";port=", still not working:Log4perl: DBI appender failed to reconnect to database after 1 attempt at ./test s/testDbCon.pl line 38 Not sure why it's saying "reconnect". thanks, David On Tue, Feb 10, 2009 at 11:59 PM, Mike Schilli <m...@pe...> wrote: > On Tue, 10 Feb 2009, David Zhao wrote: > > = DBI:mysql:dbname=tmp;host=devserv;port= >> log4perl.appender.DBAppender.username = user >> log4perl.appender.DBAppender.password = 12345 >> > > Can you connect to the database using the mysql client? Try > > mysql -uuser -p -h devserv tmp > > and when prompted for a password, type '12345'. If this works, the only > other suspicious item I noticed at first glance is the ";port=" part -- > try it without. > > -- Mike > > Mike Schilli > m...@pe... > > log4perl.appender.DBAppender.sql = \ INSERT INTO spp (loglevel, >> message) \ VALUES (?,?) log4perl.appender.DBAppender.layout >> = Log::Log4perl::Layout::NoopLayout >> log4perl.appender.DBAppender.params.1 = %c >> log4perl.appender.DBAppender.params.1 = %m >> >> and got an error >> Log4perl: DBI appender failed to reconnect to database after 1 attempt at >> ./test.pl line 37 >> >> Please help, thanks in advance! >> >> David >> >> >> >> ------------------------------------------------------------------------------ >> Create and Deploy Rich Internet Apps outside the browser with >> Adobe(R)AIR(TM) >> software. With Adobe AIR, Ajax developers can use existing skills and code >> to >> build responsive, highly engaging applications that combine the power of >> local >> resources and data with the reach of the web. Download the Adobe AIR SDK >> and >> Ajax docs to start building applications today- >> http://p.sf.net/sfu/adobe-com >> _______________________________________________ >> log4perl-devel mailing list >> log...@li... >> https://lists.sourceforge.net/lists/listinfo/log4perl-devel >> >> > |
From: Kevin M. G. <cp...@go...> - 2009-02-12 01:16:02
|
What are the rest of the contents of your testDbCon.pl script? And does this succeed? perl -MDBI -e 'DBI->connect(q/DBI:mysql:dbname=tmp;host=devserv/)' DavidZ wrote: > yes, I can connect to the database using mysql client, and tried to > connect without ";port=", still not working: > Log4perl: DBI appender failed to reconnect to database after 1 attempt > at ./test > s/testDbCon.pl line 38 > > Not sure why it's saying "reconnect". > thanks, > > David > > > On Tue, Feb 10, 2009 at 11:59 PM, Mike Schilli <m...@pe... > <mailto:m...@pe...>> wrote: > > On Tue, 10 Feb 2009, David Zhao wrote: > > = DBI:mysql:dbname=tmp;host=devserv;port= > log4perl.appender.DBAppender.username = user > log4perl.appender.DBAppender.password = 12345 > > > Can you connect to the database using the mysql client? Try > > mysql -uuser -p -h devserv tmp > > and when prompted for a password, type '12345'. If this works, the only > other suspicious item I noticed at first glance is the ";port=" part -- > try it without. > |
From: <wei...@gm...> - 2009-02-12 01:15:42
|
Hi there, I found out where the problem was, and btw, yes, perl -MDBI -e 'DBI->connect(q/DBI:mysql:dbname=tmp;host=devserv;user=user;password=pass/)' succeeded. The problem was the table was using "message" as one of the column names, which even though not a reserved word in MySQL, but somehow makes it unhappy (Unknown column 'message' in 'field list'). After I changed the column name to "msg", it's all working now. When I saw "Log4perl: DBI appender failed to reconnect to database after 1 attempt at ./tests/testDbCon.pl line 21", I thought it was the database connection issue. Maybe it'd nice that the actual DBI error was captured. BTW, in my codes, I have overridden DBI.pm to establish the database connection and return a DBH, I'd like to use that DBH for log4perl, how do I go about doing it? Thanks, David On Feb 11, 2009 4:49pm, "Kevin M. Goess" <cp...@go...> wrote: > What are the rest of the contents of your testDbCon.pl script? > > > > And does this succeed? > > > > perl -MDBI -e 'DBI->connect(q/DBI:mysql:dbname=tmp;host=devserv/)' > > > > > > > > DavidZ wrote: > > > yes, I can connect to the database using mysql client, and tried to > > > connect without ";port=", still not working: > > > Log4perl: DBI appender failed to reconnect to database after 1 attempt > > > at ./test > > > s/testDbCon.pl line 38 > > > > > > Not sure why it's saying "reconnect". > > > thanks, > > > > > > David > > > > > > > > > On Tue, Feb 10, 2009 at 11:59 PM, Mike Schilli m...@pe... > > > m...@pe...>> wrote: > > > > > > On Tue, 10 Feb 2009, David Zhao wrote: > > > > > > = DBI:mysql:dbname=tmp;host=devserv;port= > > > log4perl.appender.DBAppender.username = user > > > log4perl.appender.DBAppender.password = 12345 > > > > > > > > > Can you connect to the database using the mysql client? Try > > > > > > mysql -uuser -p -h devserv tmp > > > > > > and when prompted for a password, type '12345'. If this works, the only > > > other suspicious item I noticed at first glance is the ";port=" part -- > > > try it without. > > > > > > |
From: Mike S. <m...@pe...> - 2009-02-12 08:55:29
|
On Thu, 12 Feb 2009, wei...@gm... wrote: > When I saw "Log4perl: DBI appender failed to reconnect to database > after 1 attempt at ./tests/testDbCon.pl line 21", I thought it was the > database connection issue. Maybe it'd nice that the actual DBI error > was captured. Yeah, that was a misleading error message, I've fixed it in CVS, it will be released with 1.21. > BTW, in my codes, I have overridden DBI.pm to establish the database > connection and return a DBH, I'd like to use that DBH for log4perl, how do I > go about doing it? There's no easy way to do that right now if you're using a configuration file, but if you attach the DBI appender via add_appender() in your code, you can pass in your $dbh to the constructor via new( dbh => $dbh). -- Mike Mike Schilli m...@pe... > > Thanks, > > David > > On Feb 11, 2009 4:49pm, "Kevin M. Goess" <cp...@go...> wrote: >> What are the rest of the contents of your testDbCon.pl script? >> >> >> >> And does this succeed? >> >> >> >> perl -MDBI -e 'DBI->connect(q/DBI:mysql:dbname=tmp;host=devserv/)' >> >> >> >> >> >> >> >> DavidZ wrote: >> >>> yes, I can connect to the database using mysql client, and tried to >> >>> connect without ";port=", still not working: >> >>> Log4perl: DBI appender failed to reconnect to database after 1 attempt >> >>> at ./test >> >>> s/testDbCon.pl line 38 >> >>> >> >>> Not sure why it's saying "reconnect". >> >>> thanks, >> >>> >> >>> David >> >>> >> >>> >> >>> On Tue, Feb 10, 2009 at 11:59 PM, Mike Schilli m...@pe... >> >>> m...@pe...>> wrote: >> >>> >> >>> On Tue, 10 Feb 2009, David Zhao wrote: >> >>> >> >>> = DBI:mysql:dbname=tmp;host=devserv;port= >> >>> log4perl.appender.DBAppender.username = user >> >>> log4perl.appender.DBAppender.password = 12345 >> >>> >> >>> >> >>> Can you connect to the database using the mysql client? Try >> >>> >> >>> mysql -uuser -p -h devserv tmp >> >>> >> >>> and when prompted for a password, type '12345'. If this works, the only >> >>> other suspicious item I noticed at first glance is the ";port=" part -- >> >>> try it without. >> >>> >> >> > |