473,383 Members | 1,880 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

log4j problem in database.

rsrinivasan
221 100+
Hi,
I am using log4j to create log message. I want to write the log message to database. So i configured the log4j.properties files like this...


Expand|Select|Wrap|Line Numbers
  1. # Database Configuration
  2. log4j.appender.dbase          =org.apache.log4j.jdbc.JDBCAppender
  3. log4j.appender.dbase.layout   =org.apache.log4j.PatternLayout
  4. log4j.appender.dbase.driver   =com.microsoft.sqlserver.jdbc.SQLServerDriver
  5. log4j.appender.dbase.URL      =jdbc:sqlserver://win2003:1433/MyApp
  6. log4j.appender.dbase.user     =user
  7. log4j.appender.dbase.password =password
  8. #log4j.appender.dbase.sql     =INSERT INTO JDBCTEST VALUES ('%d - %c - %p - %m')
But i have the following errors. Where im going to wrong...

Expand|Select|Wrap|Line Numbers
  1. log4j:ERROR Failed to excute sql
  2. com.microsoft.sqlserver.jdbc.SQLServerException: The port number 1433/Pricing is not valid.
  3.     at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
  4.     at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
  5.     at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
  6.     at java.sql.DriverManager.getConnection(DriverManager.java:512)
  7.     at java.sql.DriverManager.getConnection(DriverManager.java:171)
  8.     at org.apache.log4j.jdbc.JDBCAppender.getConnection(JDBCAppender.java:212)
  9.     at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:175)
  10.     at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:250)
  11.     at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:146)
  12.     at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
  13.     at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
  14.     at org.apache.log4j.Category.callAppenders(Category.java:206)
  15.     at org.apache.log4j.Category.forcedLog(Category.java:391)
  16.     at org.apache.log4j.Category.log(Category.java:856)
Dec 20 '07 #1
4 7411
r035198x
13,262 8TB
Hi,
I am using log4j to create log message. I want to write the log message to database. So i configured the log4j.properties files like this...


Expand|Select|Wrap|Line Numbers
  1. # Database Configuration
  2. log4j.appender.dbase          =org.apache.log4j.jdbc.JDBCAppender
  3. log4j.appender.dbase.layout   =org.apache.log4j.PatternLayout
  4. log4j.appender.dbase.driver   =com.microsoft.sqlserver.jdbc.SQLServerDriver
  5. log4j.appender.dbase.URL      =jdbc:sqlserver://win2003:1433/MyApp
  6. log4j.appender.dbase.user     =user
  7. log4j.appender.dbase.password =password
  8. #log4j.appender.dbase.sql     =INSERT INTO JDBCTEST VALUES ('%d - %c - %p - %m')
But i have the following errors. Where im going to wrong...

Expand|Select|Wrap|Line Numbers
  1. log4j:ERROR Failed to excute sql
  2. com.microsoft.sqlserver.jdbc.SQLServerException: The port number 1433/Pricing is not valid.
  3.     at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
  4.     at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
  5.     at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
  6.     at java.sql.DriverManager.getConnection(DriverManager.java:512)
  7.     at java.sql.DriverManager.getConnection(DriverManager.java:171)
  8.     at org.apache.log4j.jdbc.JDBCAppender.getConnection(JDBCAppender.java:212)
  9.     at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:175)
  10.     at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:250)
  11.     at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:146)
  12.     at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
  13.     at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
  14.     at org.apache.log4j.Category.callAppenders(Category.java:206)
  15.     at org.apache.log4j.Category.forcedLog(Category.java:391)
  16.     at org.apache.log4j.Category.log(Category.java:856)
I'm not sure what your URL format should be but as you can see from the exception it's trying to use 1433/Pricing as the port. Perhaps you should have separated the 1433 and the Procing with a colon(:)?
Dec 20 '07 #2
rsrinivasan
221 100+
I'm not sure what your URL format should be but as you can see from the exception it's trying to use 1433/Pricing as the port. Perhaps you should have separated the 1433 and the Procing with a colon(:)?
I separated my port number and and MyApp(Pricing) by colon(:). Still i have the same error like this..

Expand|Select|Wrap|Line Numbers
  1. com.microsoft.sqlserver.jdbc.SQLServerException: The port number 1433:Pricing is not valid.
  2.     at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
  3.     at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
  4.     at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
  5.     at java.sql.DriverManager.getConnection(DriverManager.java:512)
  6.     at java.sql.DriverManager.getConnection(DriverManager.java:171)
  7.     at org.apache.log4j.jdbc.JDBCAppender.getConnection(JDBCAppender.java:212)
  8.     at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:175)
  9.     at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:250)
  10.     at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:146)
  11.     at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
  12.  
In this,

Expand|Select|Wrap|Line Numbers
  1.  win2001 --> is my database server name
  2.     1433      --> is the my database access port number
  3.     Pricing   --> is my Web application
What to do?

Thanks,
Dec 20 '07 #3
r035198x
13,262 8TB
I separated my port number and and MyApp(Pricing) by colon(:). Still i have the same error like this..

Expand|Select|Wrap|Line Numbers
  1. com.microsoft.sqlserver.jdbc.SQLServerException: The port number 1433:Pricing is not valid.
  2.     at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
  3.     at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
  4.     at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
  5.     at java.sql.DriverManager.getConnection(DriverManager.java:512)
  6.     at java.sql.DriverManager.getConnection(DriverManager.java:171)
  7.     at org.apache.log4j.jdbc.JDBCAppender.getConnection(JDBCAppender.java:212)
  8.     at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:175)
  9.     at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:250)
  10.     at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:146)
  11.     at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
  12.  
In this,

Expand|Select|Wrap|Line Numbers
  1.  win2001 --> is my database server name
  2.     1433      --> is the my database access port number
  3.     Pricing   --> is my Web application
What to do?

Thanks,
What if you don't put the application name at the end of the port?

P.S I'm clutching at straws here. The correct thing would be to read about what the URL format should be like.
Dec 20 '07 #4
rsrinivasan
221 100+
What if you don't put the application name at the end of the port?

P.S I'm clutching at straws here. The correct thing would be to read about what the URL format should be like.
URL is ==> http://localhost:8201/Pricing

I have the Error(Exception), when i deploy my application.

Thanks,
Dec 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Aaron Boxer | last post by:
Hello, My application is using a jar file MyJar.jar that uses log4j (I have the latest release of log4j). I have put both MyJar.jar and log4j.jar in a directory in my classpath. I have also...
2
by: Greg Scharlemann | last post by:
I have a various different packages within this web application that I am writing and I am attempting to set up log4j to log directly to a database. So each class is calling just a generic logger:...
1
by: Adi | last post by:
Hi, I have a web application (using J2EE) which runs on 3 tomcats (4.0) for Load Balancing. I have recently started to use the Log4j in this application. Currently the logs for this application...
1
by: Ragavendra BC | last post by:
Log4j Issue ----------- Hi, I am facing a problem related to Log4j... The problem is such that I have two different Log4j files one in ..properties format and the other in the .xml format.....
2
by: Hari2349 | last post by:
Regarding to log4j in java program..Plz help me... -------------------------------------------------------------------------------- Hai, friends i used the log4j.properties file like as...
1
by: Kedar Kachare | last post by:
How to use Log4j to create log files using file appender in a Servlet? Also, how to make that Servlet read the log4j.properties file? I have tried following: My web.xml( I use Eclipse europa)...
0
by: Mikhail Teterin | last post by:
Hello! I'm trying to use log4j's SMTPAppender to get warnings and errors reported by our application via e-mail (in addition to having ALL messages saved into a file via RollingFileAppender). ...
0
by: msg2ajay | last post by:
hello, I have configured %CATALINA_HOME% in Win Environ.But as I configured to "${catalina.home}/MQLog/info/info.log" for "file" in log4j.xml I can't see the log file after running my...
5
by: Abhinay | last post by:
Hi there, I am working on server which used thread pool to process each client request by separate dedicated thread. My intention was each thread ( of thread pool ) have its own logger and hence...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.