i use JMeter to do concurrence testing for web app.
environment : linux , JMeter 2.6, tomcat 6.0.35, log4j 1.2.14,
i use appender of my company which extends RollingFileAppender, it's used for creating corresponding log file according to the different user and login ip, e.g. user1-233.111-app.log.20121112
i set the threads of JMeter is 50, then run the jmeter script to test web app, there are 50 log files in tomcat/logs, but there are next problems :
each log file miss most log info, e.g. user1-233.111-app.log.20121112 only has one line info, but it should has much log info
user1's log file contains user2's log info, e.g. in user1-233.111-app.log.20121112, there are some lines like - INFO [user2] ..........
there is not user1-233.111-app.log.20121112.1, user1-233.111-app.log.20121112.2 etc
Thanks in advance!
This is surely a bug in your file appender extension class. Show code here so that you can get answer .
Related
We have older java code which was using log4j 1.17 and application logs were writing to log file properly. As part of vulnerability fixing we have to migrate to log4j 2.17.2 (Mandatory as part of compliance). We have followed the migration plan as per the Apache blog- https://logging.apache.org/log4j/2.x/manual/migration.html
So, now we have added the reference of log4j-1.2-api-2.17.2.jar, log4j-api-2.17.2.jar and log4j-core-2.17.2.jar files instead of log4j-1.17.
But, with log4j-2.17, no logs are populating in the log file....though application is running and functionalities also working....but no logs in the log file.
As soon as we refer the log4j-1.17, log files are starts populating. I am not able to figure out what is going wrong here.
Below is how the logger was instantiated in old code-
static Logger log = Logger.getLogger(SendApproverDetails.class);
Log4j.Properites files details-
Updated the log4j.properites file with
#PiotrP.Karwasz suggestion. Still no luck-
My Dev machine has JBoss while production server is running tomcat8 on AWS.
How do I setup Log (java.util.loggin) to log into default log file in the default directory, for instance following are the default paths for log files for each server. (no 3rd party loggers please)
/log/tomcat8/catalina
jboss-4.0.4/server/some_server_conf/log/
In some code examples I've seen, a FileHandler("file.log") is provided but then this log exists locally within the project folder and is not accessible from outside in a production environment. I want the application to be part of the root logging system that appends the log info into default directories and into default files.
Lateral Thinking: Please advise if there's a totally different strategy for production servers.
Part of the reason is that it's easier to see the log files right from AWS by requesting last 100 lines and I'd like to append some additional meaningful information there regarding my application as it runs.
public class Service {
private static Logger logger = Logger.getLogger("myproject");
public Service() {
logger.log(Level.INFO, "abc");
}
}
The easiest solution would be to simply install a java.util.logging.ConsoleHandler on the root logger of your myproject. That would direct all of your project output to the tomcat8-stderr.YYYY-MM-DD.log.
Otherwise you can create a ServletContextListener and install a custom handler on the root logger of your project which formats and logs to the ServletContext.log methods.
I have recently come across this line of code and i read that root logger is for system generated code
log4j.rootLogger=debug,file
where as
log4j.logger.devpinoyLogger=DEBUG, dest1
this for application logs, this will help log information generated by manual code.
Can you please explain the difference between application logs and system generated logs
I hope that you know how logs are configured for log4j. If not then open this link and follow the How log4j is configured?
Now coming back to your question that what is the difference between APPLICATION LOGS and SYSTEM GENERATED LOGS.
Application Logs:
The application log is a tool that collects messages, exceptions & errors from an application. This information is organized and displayed in a log
System Logs:
The system logs for every important action like system errors, warnings, user locks, & process message etc. in the system log
Difference:
Application logging records the progress of the execution of an application, whereas the system log record system events.
I hope this answers your question.
My application is using Spring to handle the interaction with database (Sql Server)
And commons-logging-1.1.1.jar, log4j-1.2.17.jar, slf4j-api-1.6.3.jar and slf4j-log4j12-1.7.6.jar are put into build path for the logging framework of the application.
The last two logging jar (slf4j-api and slf4j-log4j12) are for another component inside the application to use log4j.
Here is my questions:
When Spring-Jdbc runtime excecption happens, the exception is only showed in the console of eclipse with the font color red. The exception is NOT logged into the log file. But the normal log (like log.info(...)) are all in the log file. Why can't the run-time exception be in the log file and how to solve this problem.
When I use SimpleJdbcCall to call the stored procedure with parameters in MapSqlParameterSource, the following log shows up:
14:43:30 [INFO ] Added default SqlReturnUpdateCount parameter named #update-count-1
14:43:30 [INFO ] Added default SqlReturnUpdateCount parameter named #update-count-1
......
It's really annoying because the number of this message is so large. I want to turn off this particular log message without affecting another logging with the same level (INFO)
And my log4j.xml is fine I think because the logging are basically fine except the above issues.
Spring is using commons-logging internally that's why you can see the messages in your eclipse console. To redirect commons-logging to slf4j/log4j you need to remove commons-logging-1.1.1.jar from your classpath and add jcl-over-slf4j.jar from your slf4j version. To get rid of the dublicate red eclipse messages (jul and jcl) you can set the logging level in logging.properties for the console handler to warning:
java.util.logging.ConsoleHandler.level = WARNING
Second issue was solved here.
I have an application which is configured on IBM WebSphere 6.0 version.
In that application, where ever the System.out.printlN() Statements, are there
Where do they get printed?
I mean which log files, will get it printed?
In standalone I can check in the console, that application is deployed in windows server box
How to Identify where all the log.debug, log.info statements get printed from the application into the server box.
I tried checking in log4j.properties, but didnot find any useful info about that.
Background, we have a Websphere app server, where we have configured 2 Nodes and I am deploying in the Node 01, on my changes and trying to debug, but no help.
Please guide if any one has past exp on it.
I haven't been using WebSphere 6 lately. I newer versions you have a profile directory and a log directory within where the log file reside.
The second option is to go into the WAS administration console and go to "Troubleshooting > Logs and Trace > server_name " there you can directly view the logs. This way is documented for WAS 6.0 as well.
As others have hinted, by default the SystemOut.log and SystemErr.log files are located in each node's profiles/<profileName>/<serverName>/logs directory. (These locations and file names can be overridden in the Administration Console.)
log4j logs will depend on the appenders in your log4j configuration (could be a log4j.properties or a log4j.xml file), but might also be affected by whether anything in your application uses Jakarta Commons Logging. If it does, you may find all log4j logging also going to SystemOut.log.
It should get logged in Program files/IBM/SDP/profiles/runtimes/baseV6...
something like this .currently am at home and I don't have exact path.But search in profile directory .
You should always define your own path for appenders in your applications logging.xml instead of using default path of WAS.
The log files are resided at C:\Program Files\IBM\SDP\runtimes\base_v7\profiles\was70profile1\logs\server1