You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Smita Kharkar <sm...@infinium.jp> on 2006/06/19 12:13:14 UTC

Problem of Threads

Hello All,
    I have log4j in my application set to use 
org.apache.log4j.RollingFileAppender.
For one of the bugs I was analysing the log and I found that Log was getting 
printed from two threads.
I am not aware of who creates two threads and how they are managed. But 
because the log is coming from tow threads even though I test it on my 
localhost by accessing the application throught one browser instance only.
Following is snippet of the log I am getting, can somebody please tell me 
why I am getting this:

2006/06/19 14:22:11,062[TP-Processor2]-[INFO] 
db.UserRegistrationDBQueryHandler - Param email:19Jun44@19Jun44.com
2006/06/19 14:22:11,062[TP-Processor2]-[DEBUG] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.getExistingUserProfileId(), query: SELECT 
user_profile_id FROM itto_mis.user_profile WHERE email = ?
2006/06/19 14:22:11,062[TP-Processor2]-[DEBUG] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.createData(), query: insert into 
itto_mis.user_profile (user_profile_id, first_name, last_name, email, 
password, registration_date, country_code, organization_id, 
organization_name, last_update_user, last_update_date) values ( 
nextval('itto_mis.user_profile_user_profile_id_seq'), ?, ?, ?, ?, now(), ?, 
?, ?, 'WEB', now())
2006/06/19 14:22:11,109[TP-Processor3]-[INFO] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.createData()...
2006/06/19 14:22:11,109[TP-Processor3]-[INFO] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.getExistingUserProfileId()...
2006/06/19 14:22:11,109[TP-Processor3]-[INFO] 
db.UserRegistrationDBQueryHandler - Param email:19Jun44@19Jun44.com
2006/06/19 14:22:11,109[TP-Processor3]-[DEBUG] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.getExistingUserProfileId(), query: SELECT 
user_profile_id FROM itto_mis.user_profile WHERE email = ?
2006/06/19 14:22:11,125[TP-Processor2]-[DEBUG] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.createData(), ---USER PROFILE CREATED---
2006/06/19 14:22:11,125[TP-Processor2]-[DEBUG] common.MainController - 
=>trxHandler.createData(criteria) returned: true
2006/06/19 14:22:11,125[TP-Processor3]-[DEBUG] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.createData(), query: insert into 
itto_mis.user_profile (user_profile_id, first_name, last_name, email, 
password, registration_date, country_code, organization_id, 
organization_name, last_update_user, last_update_date) values ( 
nextval('itto_mis.user_profile_user_profile_id_seq'), ?, ?, ?, ?, now(), ?, 
?, ?, 'WEB', now())
2006/06/19 14:22:11,140[TP-Processor2]-[DEBUG] common.MainController - 
=>trxHandler.createData(criteria) is successful
2006/06/19 14:22:11,140[TP-Processor2]-[INFO] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.retrieveData(), query: 
java:comp/env/sql/SelectMISLoginSQL
2006/06/19 14:22:11,140[TP-Processor2]-[INFO] 
db.UserRegistrationDBQueryHandler - In 
UserRegistrationDBQueryHandler.retrieveData(), crs.size(): 1
2006/06/19 14:22:11,140[TP-Processor2]-[DEBUG] common.MainController - In 
MainController.invokeActionClass, userProfileId: 5081


Thanks and Regards,
Smita


Re: Problem of Threads

Posted by James Stauffer <st...@gmail.com>.
If your one browser makes 2 requests the application server may choose
to service each request with a different thread from its thread pool.

On 6/19/06, Smita Kharkar <sm...@infinium.jp> wrote:
> Hello All,
>     I have log4j in my application set to use
> org.apache.log4j.RollingFileAppender.
> For one of the bugs I was analysing the log and I found that Log was getting
> printed from two threads.
> I am not aware of who creates two threads and how they are managed. But
> because the log is coming from tow threads even though I test it on my
> localhost by accessing the application throught one browser instance only.
> Following is snippet of the log I am getting, can somebody please tell me
> why I am getting this:
>
> 2006/06/19 14:22:11,062[TP-Processor2]-[INFO]
> db.UserRegistrationDBQueryHandler - Param email:19Jun44@19Jun44.com
> 2006/06/19 14:22:11,062[TP-Processor2]-[DEBUG]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.getExistingUserProfileId(), query: SELECT
> user_profile_id FROM itto_mis.user_profile WHERE email = ?
> 2006/06/19 14:22:11,062[TP-Processor2]-[DEBUG]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.createData(), query: insert into
> itto_mis.user_profile (user_profile_id, first_name, last_name, email,
> password, registration_date, country_code, organization_id,
> organization_name, last_update_user, last_update_date) values (
> nextval('itto_mis.user_profile_user_profile_id_seq'), ?, ?, ?, ?, now(), ?,
> ?, ?, 'WEB', now())
> 2006/06/19 14:22:11,109[TP-Processor3]-[INFO]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.createData()...
> 2006/06/19 14:22:11,109[TP-Processor3]-[INFO]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.getExistingUserProfileId()...
> 2006/06/19 14:22:11,109[TP-Processor3]-[INFO]
> db.UserRegistrationDBQueryHandler - Param email:19Jun44@19Jun44.com
> 2006/06/19 14:22:11,109[TP-Processor3]-[DEBUG]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.getExistingUserProfileId(), query: SELECT
> user_profile_id FROM itto_mis.user_profile WHERE email = ?
> 2006/06/19 14:22:11,125[TP-Processor2]-[DEBUG]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.createData(), ---USER PROFILE CREATED---
> 2006/06/19 14:22:11,125[TP-Processor2]-[DEBUG] common.MainController -
> =>trxHandler.createData(criteria) returned: true
> 2006/06/19 14:22:11,125[TP-Processor3]-[DEBUG]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.createData(), query: insert into
> itto_mis.user_profile (user_profile_id, first_name, last_name, email,
> password, registration_date, country_code, organization_id,
> organization_name, last_update_user, last_update_date) values (
> nextval('itto_mis.user_profile_user_profile_id_seq'), ?, ?, ?, ?, now(), ?,
> ?, ?, 'WEB', now())
> 2006/06/19 14:22:11,140[TP-Processor2]-[DEBUG] common.MainController -
> =>trxHandler.createData(criteria) is successful
> 2006/06/19 14:22:11,140[TP-Processor2]-[INFO]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.retrieveData(), query:
> java:comp/env/sql/SelectMISLoginSQL
> 2006/06/19 14:22:11,140[TP-Processor2]-[INFO]
> db.UserRegistrationDBQueryHandler - In
> UserRegistrationDBQueryHandler.retrieveData(), crs.size(): 1
> 2006/06/19 14:22:11,140[TP-Processor2]-[DEBUG] common.MainController - In
> MainController.invokeActionClass, userProfileId: 5081
>
>
> Thanks and Regards,
> Smita
>
>
>


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

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