Link to home
Start Free TrialLog in
Avatar of Sathish David  Kumar N
Sathish David Kumar NFlag for India

asked on

is it possible to create log file for each country

Hi i have deployed my applciation for 22 country with one server . i am using log4j for logging

i need to create for each country is that possible ? like i am connection to DB schema !
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

How do you deploy it?
Avatar of Sathish David  Kumar N

ASKER

its single application only . connect with different schema for that country
Avatar of garypfirstech
garypfirstech

There are many ways to do this.  I guess what you're talking about is a separate Logger for each country.  It depends on how you're instantiating the class so the issue here is in the details and it's hard to give a general answer without knowing more details about your application.

For example, if you instantiate a separate instance of a class for each country, you could make the Logger a field in the instance (as opposed to the usual practice of a static field in the class itself). Then, you could make the name of your Logger in your programs have the name of the country included in the Logger name, eg

Logger myLogger = Logger.getLogger(countryName + thisClass.class.getName());

So each instance of thisClass would have the appropriate logger.  Then you could issue your log requests in the usual way and have them go to separate appenders based on the logger name.

If this solution is not appropriate, perhaps you could provide more details about how you're connecting to a different schema for each country.

Actully how my application is work is !

when user login time i connect to admin schema and check the user deatils after that get country and his  schema so after that user transcation are coming with that country schema only !

eg:

I am sathish belonging to india so it will connected to india schema . like wise i want to create log file for each country  ?

how can i do that  ?
And how do you keep track of which schema to connect to when you need it later in the session?  Where is that information stored?  Do you instantiate a separate instance of each class for each user with the schema stored in that instance?
>>>>>>And how do you keep track of which schema to connect to when you need it later in the session?  Where is that information stored?  

i put it session and used it.

>>>>Do you instantiate a separate instance of each class for each user with the schema stored in that instance?


i am not getting ur point
ASKER CERTIFIED SOLUTION
Avatar of garypfirstech
garypfirstech

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>>>>>Logger myLogger = Logger.getLogger(countryNameObtainedFromSession + thisClass.class.getName());


is i want to declare anything in log4j.propety file
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial