I have the following questions related to the log that gets generated by p6spy using spy.properties.
I have en entry in spy.properties as: logfile=c:\\spy.log As such, file called spy.log genst generated under C: drive.
Following are my questions:
1. How can I capture the start time and the end time of SQL in spy.log (logfile=c:\\spy.log)? Can I capture these two values by making certain configurations in spy.properties? Please show me how.
2. What do I have to do so that the result and resultSet related to the query does not get displayed in spy.log (logfile=c:\\spy.log)file? I only want to see the prepared statement and the preparedstatement with the value. I do not want to see the result generated from the SQL in the spy.log.
How can I accomplish the above by changing settings in spy.properties?
In other words, I want to see only the following entries in spy.log:
select col1 from table1 where id=? select col1 from table1 where id=1
I do not want to see the result returned from the above query in spy.log.
3. If I point the logfile attribute in spy.properties to the output file of log4j, will both log4j and p6spy write to the same (single) log file?
In other words, if I add the following in spy.properties: logfile=c:\\mylog4j.log
Will both p6spy and log4j write the the above mylog4j.log file?
4. What are the place holder values in between the first few pipes in the log file that gets generated by p6spy?
For example, in the output that is written to spy.log, what attribute is being presented inside each of these pipes?
5. What do I have to do, if I do not want the formatting with pipe (e.g. 1225296359390|-1||debug||) that p6spy generates? Instead, I would like the formatting similar to the one generated by log4j. What modifications in spy.properties do I need in oprder to accomplish this?
6. What do I have to do to have p6spy generate the same formatting as that of my existing log4j formatting? Do I have to make same entries log4j specific entries in spy.properties?
In spy.properties, I have commented out the following at this time:
#The following are for log4j logging only #log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender #log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout #log4j.appender.STDOUT.layout.ConversionPattern=p6spy - %m%n
Do I have to uncomment the above entries in spy.properties and set them up similar to my log4j properties, in order for p6spy to generate log similar to my log4j?
7. What do I need to do to capture the time taken to run sql, while using log4j type of logging? Bt default, p6spy shows the duration of SQL as a value of inside one of the pipes. But if I want to make p6spy log similar to my log4j file, but still want to capture the duration of SQL, what do I need to do?
8. What should be my setting for includecategories and excludecategoriesShould, if I want to display every possible SQL?
Following is my spy.properties file:
realdriver=COM.ibm.db2.jdbc.app.DB2Driver deregisterdrivers=true executionthreshold= outagedetection=false outagedetectioninterval= filter=false include = exclude = sqlexpression = autoflush = true dateformat= includecategories=info,debug,result,batch excludecategories= stringmatcher= stacktrace=false stacktraceclass= reloadproperties=true reloadpropertiesinterval=60 useprefix=false appender=com.p6spy.engine.logging.appender.FileLogger logfile=c:\\spy.log append=true #The following are for log4j logging only #log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender #log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout #log4j.appender.STDOUT.layout.ConversionPattern=p6spy - %m%n
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com