EOS下控制台以及图形界面打印sql语句

场景需求:在eos中打印sql语句,包括数据实体,查询实体和命名sql的sql语句。

所需资源:

P6spy:负责拦截sql,并打印。
Sqlprofiler:解析p6spy拦截的sql,在基于swing的图形界面上显示,并提供监控分析功能。
Spy.properties:p6spy配置文件,用来指定数据库驱动,打印sql的目的地(文件,控制台,sqlprofiler界面),打印格式等。

EOS控制台打印

  1. 复制p6spy.ar,sqlprofiler.jar到web应用的lib目录下(如D:\Primeton\eos702\apache-tomcat-5.5.20\webapps\default\WEB-INF\lib)。
  2. 复制spy.properties到classpath下(如D:\Primeton\eos702\apache-tomcat-5.5.20\webapps\default\WEB-INF\classes)。
  3. 修改系统配置文件user-config.xml(D:\Primeton\eos702\apps_config\default\config),修改数据源的驱动路径为:com.p6spy.engine.spy.P6SpyDriver。
  4. 修改spy.properties文件为如下:

################################################################P6Spy Options File #

  1. See documentation for detailed instructions #
    #################################################################
    #################################################################
  2. MODULES #
  3. #
  4. Modules provide the P6Spy functionality. If a module, such #
  5. as module_log is commented out, that functionality will not #
  6. be available. If it is not commented out (if it is active), #
  7. the functionality will be active. #
  8. #
  9. Values set in Modules cannot be reloaded using the #
  10. reloadproperties variable. Once they are loaded, they remain #
  11. in memory until the application is restarted. #
  12. #
    #################################################################
    module.log=com.p6spy.engine.logging.P6LogFactory
    #module.outage=com.p6spy.engine.outage.P6OutageFactory
    #################################################################
  13. REALDRIVER(s) #
  14. #
  15. In your application server configuration file you replace the #
  16. "real driver" name with com.p6spy.engine.P6SpyDriver. This is #
  17. where you put the name of your real driver P6Spy can find and #
  18. register your real driver to do the database work. #
  19. #
  20. If your application uses several drivers specify them in #
  21. realdriver2, realdriver3. See the documentation for more #
  22. details. #
  23. #
  24. Values set in REALDRIVER(s) cannot be reloaded using the #
  25. reloadproperties variable. Once they are loaded, they remain #
  26. in memory until the application is restarted. #
  27. #
    #################################################################
  28. oracle driver
  29. realdriver=oracle.jdbc.driver.OracleDriver
  30. mysql Connector/J driver
  31. realdriver=com.mysql.jdbc.Driver
  32. informix driver
  33. realdriver=com.informix.jdbc.IfxDriver
  34. ibm db2 driver
  35. realdriver=COM.ibm.db2.jdbc.net.DB2Driver
  36. the mysql open source driver
    realdriver=com.mysql.jdbc.Driver
    #specifies another driver to use
    realdriver2=
    #specifies a third driver to use
    realdriver3=

    #the DriverManager class sequentially tries every driver that is
    #registered to find the right driver. In some instances, it's possible to
    #load up the realdriver before the p6spy driver, in which case your connections
    #will not get wrapped as the realdriver will "steal" the connection before
    #p6spy sees it. Set the following property to "true" to cause p6spy to
    #explicitily deregister the realdrivers
    deregisterdrivers=false
    ################################################################

  37. P6LOG SPECIFIC PROPERTIES #
    ################################################################
  38. no properties currently available
    ################################################################
  39. EXECUTION THRESHOLD PROPERTIES #
    ################################################################
  40. This feature applies to the standard logging of P6Spy. #
  41. While the standard logging logs out every statement #
  42. regardless of its execution time, this feature puts a time #
  43. condition on that logging. Only statements that have taken #
  44. longer than the time specified (in milliseconds) will be #
  45. logged. This way it is possible to see only statements that #
  46. have exceeded some high water mark. #
  47. This time is reloadable. #
    #
  48. executionthreshold=integer time (milliseconds)
    #
    executionthreshold=
    ################################################################
  49. P6OUTAGE SPECIFIC PROPERTIES #
    ################################################################
  50. Outage Detection
    #
  51. This feature detects long-running statements that may be indicative of
  52. a database outage problem. If this feature is turned on, it will log any
  53. statement that surpasses the configurable time boundary during its execution.
  54. When this feature is enabled, no other statements are logged except the long
  55. running statements. The interval property is the boundary time set in seconds.
  56. For example, if this is set to 2, then any statement requiring at least 2
  57. seconds will be logged. Note that the same statement will continue to be logged
  58. for as long as it executes. So if the interval is set to 2, and the query takes
  59. 11 seconds, it will be logged 5 times (at the 2, 4, 6, 8, 10 second intervals).
    #
  60. outagedetection=true|false
  61. outagedetectioninterval=integer time (seconds)
    #
    outagedetection=false
    outagedetectioninterval=
    ################################################################
  62. COMMON PROPERTIES #
    ################################################################
  63. filter what is logged
    filter=false
  64. comma separated list of tables to include when filtering
    include =
  65. comma separated list of tables to exclude when filtering
    exclude =
  66. sql expression to evaluate if using regex filtering
    sqlexpression =
  67. turn on tracing
    autoflush = true
  68. sets the date format using Java's SimpleDateFormat routine
    dateformat=yyyy-MM-dd HH:mm:ss:SS
    #list of categories to explicitly include
    includecategories=
    #list of categories to exclude: error, info, batch, debug, statement,
    #commit, rollback and result are valid values
    excludecategories=info,debug,result,batch

    #allows you to use a regex engine or your own matching engine to determine
    #which statements to log
    #
    #stringmatcher=com.p6spy.engine.common.GnuRegexMatcher
    #stringmatcher=com.p6spy.engine.common.JakartaRegexMatcher
    stringmatcher=

  69. prints a stack trace for every statement logged
    stacktrace=false
  70. if stacktrace=true, specifies the stack trace to print
    stacktraceclass=
  71. determines if property file should be reloaded
    reloadproperties=false
  72. determines how often should be reloaded in seconds
    reloadpropertiesinterval=60
    #if=true then url must be prefixed with p6spy:
    useprefix=false
    #specifies the appender to use for logging
    #appender=com.p6spy.engine.logging.appender.Log4jLogger
    appender=com.p6spy.engine.logging.appender.StdoutLogger
    #appender=com.p6spy.engine.logging.appender.FileLogger
  73. name
    of logfile to use, note Windows users should make sure to use forward
    slashes in their pathname (e:/test/spy.log) (used for file logger only)
    logfile = spy.log
  74. append to the p6spy log file. if this is set to false the
  75. log file is truncated every time. (file logger only)
    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
    #log4j.appender.SQLPROFILER_CLIENT=org.apache.log4j.net.SocketAppender
    #log4j.appender.SQLPROFILER_CLIENT.RemoteHost=localhost
    #log4j.appender.SQLPROFILER_CLIENT.Port=4445
    #log4j.appender.SQLPROFILER_CLIENT.LocationInfo=true
    log4j.logger.p6spy=INFO,STDOUT

    #################################################################

  76. DataSource replacement #
  77. #
  78. Replace the real DataSource class in your application server #
  79. configuration with the name com.p6spy.engine.spy.P6DataSource,#
  80. then add the JNDI name and class name of the real #
  81. DataSource here #
  82. #
  83. Values set in this item cannot be reloaded using the #
  84. reloadproperties variable. Once it is loaded, it remains #
  85. in memory until the application is restarted. #
  86. #
    #################################################################
    #realdatasource=/RealMySqlDS
    #realdatasourceclass=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
    #################################################################
  87. DataSource properties #
  88. #
  89. If you are using the DataSource support to intercept calls #
  90. to a DataSource that requires properties for proper setup, #
  91. define those properties here. Use name value pairs, separate #
  92. the name and value with a semicolon, and separate the #
  93. pairs with commas. #
  94. #
  95. The example shown here is for mysql #
  96. #
    #################################################################
    #realdatasourceproperties=port;3306,serverName;ibmhost,databaseName;mydb

    #################################################################

  97. JNDI DataSource lookup #
  98. #
  99. If you are using the DataSource support outside of an app #
  100. server, you will probably need to define the JNDI Context #
  101. environment. #
  102. #
  103. If the P6Spy code will be executing inside an app server then #
  104. do not use these properties, and the DataSource lookup will #
  105. use the naming context defined by the app server. #
  106. #
  107. The two standard elements of the naming environment are#
  108. jndicontextfactory and jndicontextproviderurl. If you need #
  109. additional elements, use the jndicontextcustom property. #
  110. You can define multiple properties in jndicontextcustom, #
  111. in name value pairs. Separate the name and value with a #
  112. semicolon, and separate the pairs with commas. #
  113. #
  114. The example shown here is for a standalone program running on #
  115. a machine that is also running JBoss, so the JDNI context #
  116. is configured for JBoss (3.0.4). #
  117. #
    #################################################################
    #jndicontextfactory=org.jnp.interfaces.NamingContextFactory
    #jndicontextproviderurl=localhost:1099
    #jndicontextcustom=java.naming.factory.url.pkgs;org.jboss.nameing:org.jnp.interfaces

    #jndicontextfactory=com.ibm.websphere.naming.WsnInitialContextFactory
    #jndicontextproviderurl=iiop://localhost:900
  118. 启动eos服务器,控制台在调用数据库查询的时候会打印如下的内容,即配置成功:

文件中打印

  1. 复制p6spy.ar,sqlprofiler.jar到web应用的lib目录下(如D:\Primeton\eos702\apache-tomcat-5.5.20\webapps\default\WEB-INF\lib)。
  2. 复制spy.properties到classpath下(如D:\Primeton\eos702\apache-tomcat-5.5.20\webapps\default\WEB-INF\classes)。
  3. 修改系统配置文件user-config.xml(D:\Primeton\eos702\apps_config\default\config),修改数据源的驱动路径为:com.p6spy.engine.spy.P6SpyDriver。
  4. 修改spy.properties文件为如下:

#################################################################

  1. P6Spy Options File #
  2. See documentation for detailed instructions #
    #################################################################
    #################################################################
  3. MODULES #
  4. #
  5. Modules provide the P6Spy functionality. If a module, such #
  6. as module_log is commented out, that functionality will not #
  7. be available. If it is not commented out (if it is active), #
  8. the functionality will be active. #
  9. #
  10. Values set in Modules cannot be reloaded using the #
  11. reloadproperties variable. Once they are loaded, they remain #
  12. in memory until the application is restarted. #
  13. #
    #################################################################
    module.log=com.p6spy.engine.logging.P6LogFactory
    #module.outage=com.p6spy.engine.outage.P6OutageFactory
    #################################################################
  14. REALDRIVER(s) #
  15. #
  16. In your application server configuration file you replace the #
  17. "real driver" name with com.p6spy.engine.P6SpyDriver. This is #
  18. where you put the name of your real driver P6Spy can find and #
  19. register your real driver to do the database work. #
  20. #
  21. If your application uses several drivers specify them in #
  22. realdriver2, realdriver3. See the documentation for more #
  23. details. #
  24. #
  25. Values set in REALDRIVER(s) cannot be reloaded using the #
  26. reloadproperties variable. Once they are loaded, they remain #
  27. in memory until the application is restarted. #
  28. #
    #################################################################
  29. oracle driver
  30. realdriver=oracle.jdbc.driver.OracleDriver
  31. mysql Connector/J driver
  32. realdriver=com.mysql.jdbc.Driver
  33. informix driver
  34. realdriver=com.informix.jdbc.IfxDriver
  35. ibm db2 driver
  36. realdriver=COM.ibm.db2.jdbc.net.DB2Driver
  37. the mysql open source driver
    realdriver=com.mysql.jdbc.Driver
    #specifies another driver to use
    realdriver2=
    #specifies a third driver to use
    realdriver3=

    #the DriverManager class sequentially tries every driver that is
    #registered to find the right driver. In some instances, it's possible to
    #load up the realdriver before the p6spy driver, in which case your connections
    #will not get wrapped as the realdriver will "steal" the connection before
    #p6spy sees it. Set the following property to "true" to cause p6spy to
    #explicitily deregister the realdrivers
    deregisterdrivers=false
    ################################################################

  38. P6LOG SPECIFIC PROPERTIES #
    ################################################################
  39. no properties currently available
    ################################################################
  40. EXECUTION THRESHOLD PROPERTIES #
    ################################################################
  41. This feature applies to the standard logging of P6Spy. #
  42. While the standard logging logs out every statement #
  43. regardless of its execution time, this feature puts a time #
  44. condition on that logging. Only statements that have taken #
  45. longer than the time specified (in milliseconds) will be #
  46. logged. This way it is possible to see only statements that #
  47. have exceeded some high water mark. #
  48. This time is reloadable. #
    #
  49. executionthreshold=integer time (milliseconds)
    #
    executionthreshold=
    ################################################################
  50. P6OUTAGE SPECIFIC PROPERTIES #
    ################################################################
  51. Outage Detection
    #
  52. This feature detects long-running statements that may be indicative of
  53. a database outage problem. If this feature is turned on, it will log any
  54. statement that surpasses the configurable time boundary during its execution.
  55. When this feature is enabled, no other statements are logged except the long
  56. running statements. The interval property is the boundary time set in seconds.
  57. For example, if this is set to 2, then any statement requiring at least 2
  58. seconds will be logged. Note that the same statement will continue to be logged
  59. for as long as it executes. So if the interval is set to 2, and the query takes
  60. 11 seconds, it will be logged 5 times (at the 2, 4, 6, 8, 10 second intervals).
    #
  61. outagedetection=true|false
  62. outagedetectioninterval=integer time (seconds)
    #
    outagedetection=false
    outagedetectioninterval=
    ################################################################
  63. COMMON PROPERTIES #
    ################################################################
  64. filter what is logged
    filter=false
  65. comma separated list of tables to include when filtering
    include =
  66. comma separated list of tables to exclude when filtering
    exclude =
  67. sql expression to evaluate if using regex filtering
    sqlexpression =
  68. turn on tracing
    autoflush = true
  69. sets the date format using Java's SimpleDateFormat routine
    dateformat=yyyy-MM-dd HH:mm:ss:SS
    #list of categories to explicitly include
    includecategories=
    #list of categories to exclude: error, info, batch, debug, statement,
    #commit, rollback and result are valid values
    excludecategories=info,debug,result,batch

    #allows you to use a regex engine or your own matching engine to determine
    #which statements to log
    #
    #stringmatcher=com.p6spy.engine.common.GnuRegexMatcher
    #stringmatcher=com.p6spy.engine.common.JakartaRegexMatcher
    stringmatcher=

  70. prints a stack trace for every statement logged
    stacktrace=false
  71. if stacktrace=true, specifies the stack trace to print
    stacktraceclass=
  72. determines if property file should be reloaded
    reloadproperties=false
  73. determines how often should be reloaded in seconds
    reloadpropertiesinterval=60
    #if=true then url must be prefixed with p6spy:
    useprefix=false
    #specifies the appender to use for logging
    #appender=com.p6spy.engine.logging.appender.Log4jLogger
    #appender=com.p6spy.engine.logging.appender.StdoutLogger
    appender=com.p6spy.engine.logging.appender.FileLogger
  74. name
    of logfile to use, note Windows users should make sure to use forward
    slashes in their pathname (e:/test/spy.log) (used for file logger only)
    logfile = c:/abc/spy.log
  75. append to the p6spy log file. if this is set to false the
  76. log file is truncated every time. (file logger only)
    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

    #log4j.appender.CHAINSAW_CLIENT=org.apache.log4j.net.SocketAppender
    #log4j.appender.CHAINSAW_CLIENT.RemoteHost=localhost
    #log4j.appender.CHAINSAW_CLIENT.Port=4445
    #log4j.appender.CHAINSAW_CLIENT.LocationInfo=true

    log4j.logger.p6spy=INFO,STDOUT

    #################################################################

  77. DataSource replacement #
  78. #
  79. Replace the real DataSource class in your application server #
  80. configuration with the name com.p6spy.engine.spy.P6DataSource,#
  81. then add the JNDI name and class name of the real #
  82. DataSource here #
  83. #
  84. Values set in this item cannot be reloaded using the #
  85. reloadproperties variable. Once it is loaded, it remains #
  86. in memory until the application is restarted. #
  87. #
    #################################################################
    #realdatasource=/RealMySqlDS
    #realdatasourceclass=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
    #################################################################
  88. DataSource properties #
  89. #
  90. If you are using the DataSource support to intercept calls #
  91. to a DataSource that requires properties for proper setup, #
  92. define those properties here. Use name value pairs, separate #
  93. the name and value with a semicolon, and separate the #
  94. pairs with commas. #
  95. #
  96. The example shown here is for mysql #
  97. #
    #################################################################
    #realdatasourceproperties=port;3306,serverName;ibmhost,databaseName;mydb

    #################################################################

  98. JNDI DataSource lookup #
  99. #
  100. If you are using the DataSource support outside of an app #
  101. server, you will probably need to define the JNDI Context #
  102. environment. #
  103. #
  104. If the P6Spy code will be executing inside an app server then #
  105. do not use these properties, and the DataSource lookup will #
  106. use the naming context defined by the app server. #
  107. #
  108. The two standard elements of the naming environment are#
  109. jndicontextfactory and jndicontextproviderurl. If you need #
  110. additional elements, use the jndicontextcustom property. #
  111. You can define multiple properties in jndicontextcustom, #
  112. in name value pairs. Separate the name and value with a #
  113. semicolon, and separate the pairs with commas. #
  114. #
  115. The example shown here is for a standalone program running on #
  116. a machine that is also running JBoss, so the JDNI context #
  117. is configured for JBoss (3.0.4). #
  118. #
    #################################################################
    #jndicontextfactory=org.jnp.interfaces.NamingContextFactory
    #jndicontextproviderurl=localhost:1099
    #jndicontextcustom=java.naming.factory.url.pkgs;org.jboss.nameing:org.jnp.interfaces

    #jndicontextfactory=com.ibm.websphere.naming.WsnInitialContextFactory
    #jndicontextproviderurl=iiop://localhost:900
  119. 启动前请在指定的路径下新建日志文件(logfile = c:/abc/spy.log),启动EOS服务器会在c:/abc/spy.log看到如下内容,表示配置成功:

图形界面中打印

  1. 复制p6spy.ar,sqlprofiler.jar到web应用的lib目录下(如D:\Primeton\eos702\apache-tomcat-5.5.20\webapps\default\WEB-INF\lib)。
  2. 复制spy.properties到classpath下(如D:\Primeton\eos702\apache-tomcat-5.5.20\webapps\default\WEB-INF\classes)。
  3. 修改系统配置文件user-config.xml(D:\Primeton\eos702\apps_config\default\config),修改数据源的驱动路径为:com.p6spy.engine.spy.P6SpyDriver。
  4. 修改spy.properties文件为如下:

#################################################################

  1. P6Spy Options File #
  2. See documentation for detailed instructions #
    #################################################################
    #################################################################
  3. MODULES #
  4. #
  5. Modules provide the P6Spy functionality. If a module, such #
  6. as module_log is commented out, that functionality will not #
  7. be available. If it is not commented out (if it is active), #
  8. the functionality will be active. #
  9. #
  10. Values set in Modules cannot be reloaded using the #
  11. reloadproperties variable. Once they are loaded, they remain #
  12. in memory until the application is restarted. #
  13. #
    #################################################################
    module.log=com.p6spy.engine.logging.P6LogFactory
    #module.outage=com.p6spy.engine.outage.P6OutageFactory
    #################################################################
  14. REALDRIVER(s) #
  15. #
  16. In your application server configuration file you replace the #
  17. "real driver" name with com.p6spy.engine.P6SpyDriver. This is #
  18. where you put the name of your real driver P6Spy can find and #
  19. register your real driver to do the database work. #
  20. #
  21. If your application uses several drivers specify them in #
  22. realdriver2, realdriver3. See the documentation for more #
  23. details. #
  24. #
  25. Values set in REALDRIVER(s) cannot be reloaded using the #
  26. reloadproperties variable. Once they are loaded, they remain #
  27. in memory until the application is restarted. #
  28. #
    #################################################################
  29. oracle driver
  30. realdriver=oracle.jdbc.driver.OracleDriver
  31. mysql Connector/J driver
  32. realdriver=com.mysql.jdbc.Driver
  33. informix driver
  34. realdriver=com.informix.jdbc.IfxDriver
  35. ibm db2 driver
  36. realdriver=COM.ibm.db2.jdbc.net.DB2Driver
  37. the mysql open source driver
    realdriver=com.mysql.jdbc.Driver
    #specifies another driver to use
    realdriver2=
    #specifies a third driver to use
    realdriver3=

    #the DriverManager class sequentially tries every driver that is
    #registered to find the right driver. In some instances, it's possible to
    #load up the realdriver before the p6spy driver, in which case your connections
    #will not get wrapped as the realdriver will "steal" the connection before
    #p6spy sees it. Set the following property to "true" to cause p6spy to
    #explicitily deregister the realdrivers
    deregisterdrivers=false
    ################################################################

  38. P6LOG SPECIFIC PROPERTIES #
    ################################################################
  39. no properties currently available
    ################################################################
  40. EXECUTION THRESHOLD PROPERTIES #
    ################################################################
  41. This feature applies to the standard logging of P6Spy. #
  42. While the standard logging logs out every statement #
  43. regardless of its execution time, this feature puts a time #
  44. condition on that logging. Only statements that have taken #
  45. longer than the time specified (in milliseconds) will be #
  46. logged. This way it is possible to see only statements that #
  47. have exceeded some high water mark. #
  48. This time is reloadable. #
    #
  49. executionthreshold=integer time (milliseconds)
    #
    executionthreshold=
    ################################################################
  50. P6OUTAGE SPECIFIC PROPERTIES #
    ################################################################
  51. Outage Detection
    #
  52. This feature detects long-running statements that may be indicative of
  53. a database outage problem. If this feature is turned on, it will log any
  54. statement that surpasses the configurable time boundary during its execution.
  55. When this feature is enabled, no other statements are logged except the long
  56. running statements. The interval property is the boundary time set in seconds.
  57. For example, if this is set to 2, then any statement requiring at least 2
  58. seconds will be logged. Note that the same statement will continue to be logged
  59. for as long as it executes. So if the interval is set to 2, and the query takes
  60. 11 seconds, it will be logged 5 times (at the 2, 4, 6, 8, 10 second intervals).
    #
  61. outagedetection=true|false
  62. outagedetectioninterval=integer time (seconds)
    #
    outagedetection=false
    outagedetectioninterval=
    ################################################################
  63. COMMON PROPERTIES #
    ################################################################
  64. filter what is logged
    filter=false
  65. comma separated list of tables to include when filtering
    include =
  66. comma separated list of tables to exclude when filtering
    exclude =
  67. sql expression to evaluate if using regex filtering
    sqlexpression =
  68. turn on tracing
    autoflush = true
  69. sets the date format using Java's SimpleDateFormat routine
    dateformat=
    #list of categories to explicitly include
    includecategories=
    #list of categories to exclude: error, info, batch, debug, statement,
    #commit, rollback and result are valid values
    excludecategories=info,debug,result,batch

    #allows you to use a regex engine or your own matching engine to determine
    #which statements to log
    #
    #stringmatcher=com.p6spy.engine.common.GnuRegexMatcher
    #stringmatcher=com.p6spy.engine.common.JakartaRegexMatcher
    stringmatcher=

  70. prints a stack trace for every statement logged
    stacktrace=false
  71. if stacktrace=true, specifies the stack trace to print
    stacktraceclass=
  72. determines if property file should be reloaded
    reloadproperties=false
  73. determines how often should be reloaded in seconds
    reloadpropertiesinterval=60
    #if=true then url must be prefixed with p6spy:
    useprefix=false
    #specifies the appender to use for logging
    appender=com.p6spy.engine.logging.appender.Log4jLogger
    #appender=com.p6spy.engine.logging.appender.StdoutLogger
    #appender=com.p6spy.engine.logging.appender.FileLogger
  74. name
    of logfile to use, note Windows users should make sure to use forward
    slashes in their pathname (e:/test/spy.log) (used for file logger only)
    #logfile = spy.log
  75. append to the p6spy log file. if this is set to false the
  76. log file is truncated every time. (file logger only)
    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

    log4j.appender.SQLPROFILER_CLIENT=org.apache.log4j.net.SocketAppender
    log4j.appender.SQLPROFILER_CLIENT.RemoteHost=localhost
    log4j.appender.SQLPROFILER_CLIENT.Port=4445
    log4j.appender.SQLPROFILER_CLIENT.LocationInfo=true

    #log4j.logger.p6spy=INFO,STDOUT
    log4j.logger.p6spy=DEBUG, SQLPROFILER_CLIENT

    #################################################################

  77. DataSource replacement #
  78. #
  79. Replace the real DataSource class in your application server #
  80. configuration with the name com.p6spy.engine.spy.P6DataSource,#
  81. then add the JNDI name and class name of the real #
  82. DataSource here #
  83. #
  84. Values set in this item cannot be reloaded using the #
  85. reloadproperties variable. Once it is loaded, it remains #
  86. in memory until the application is restarted. #
  87. #
    #################################################################
    #realdatasource=/RealMySqlDS
    #realdatasourceclass=com.mysql.jdbc.jdbc2.optional.MysqlDataSource
    #################################################################
  88. DataSource properties #
  89. #
  90. If you are using the DataSource support to intercept calls #
  91. to a DataSource that requires properties for proper setup, #
  92. define those properties here. Use name value pairs, separate #
  93. the name and value with a semicolon, and separate the #
  94. pairs with commas. #
  95. #
  96. The example shown here is for mysql #
  97. #
    #################################################################
    #realdatasourceproperties=port;3306,serverName;ibmhost,databaseName;mydb

    #################################################################

  98. JNDI DataSource lookup #
  99. #
  100. If you are using the DataSource support outside of an app #
  101. server, you will probably need to define the JNDI Context #
  102. environment. #
  103. #
  104. If the P6Spy code will be executing inside an app server then #
  105. do not use these properties, and the DataSource lookup will #
  106. use the naming context defined by the app server. #
  107. #
  108. The two standard elements of the naming environment are#
  109. jndicontextfactory and jndicontextproviderurl. If you need #
  110. additional elements, use the jndicontextcustom property. #
  111. You can define multiple properties in jndicontextcustom, #
  112. in name value pairs. Separate the name and value with a #
  113. semicolon, and separate the pairs with commas. #
  114. #
  115. The example shown here is for a standalone program running on #
  116. a machine that is also running JBoss, so the JDNI context #
  117. is configured for JBoss (3.0.4). #
  118. #
    #################################################################
    #jndicontextfactory=org.jnp.interfaces.NamingContextFactory
    #jndicontextproviderurl=localhost:1099
    #jndicontextcustom=java.naming.factory.url.pkgs;org.jboss.nameing:org.jnp.interfaces

    #jndicontextfactory=com.ibm.websphere.naming.WsnInitialContextFactory
    #jndicontextproviderurl=iiop://localhost:900
  119. 打开命令行窗口,进入sqlprofiler所在的路径,我这里是:D:\Primeton\eos702\apache-tomcat-5.5.20\webapps\default\WEB-INF\lib,执行

java -jar sqlprofiler.jar命令,弹出如下窗口:

启动EOS服务器,调用数据库查询功能,sqlprofiler中会显示类似于如下的信息:

配置完成。

<__________________________本文系转载,特此声明——————————————>

所需资源:

v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}

Normal
0

7.8 磅
0
2

false
false
false

EN-US
ZH-CN
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:普通表格;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}

EOS下控制台以及图形界面打印sql语句的更多相关文章

  1. maven项目整合SSM配置log4j, 实现控制台打印SQL语句

    在原有项目正常启动的情况下, 实现在控制台打印mapper包下SQL语句. 1.在pom.xml配置文件中添加两个依赖(缺一不可) <!--日志包--> <dependency> ...

  2. centOS7下安装GUI图形界面

    1.如何在centOS7下安装GUI图形界面 当你安装centOS7服务器版本的时候,系统默认是不会安装GUI的图形界面程序,这个需要手动安装CentOS7 Gnome GUI包. 2.在系统下使用命 ...

  3. mybatis下使用log4j打印sql语句和执行结果

    转载自:https://www.cnblogs.com/jeevan/p/3493972.html 本来以为很简单的问题, 结果自己搞了半天还是不行; 然后google, baidu, 搜出来各种方法 ...

  4. CentOS7 下安装GUI图形界面GNOME

    在安装Gnome包之前,需要检查一下网络是否有网络(使用ping www.baidu.com) 一.先装X windows,-y表示参数同意所有软件安装操,当出现 Complete!说明这里安装成功了 ...

  5. Springboot中mybatis控制台打印sql语句

    Springboot中mybatis控制台打印sql语句 https://www.jianshu.com/p/3cfe5f6e9174 https://www.jianshu.com/go-wild? ...

  6. 9、springcloud整合logback打印sql语句

    Logback是由log4j创始人设计的又一个开源日志组件.logback当前分成三个模块:logback-core.logback- classic和logback-access.logback-c ...

  7. mybatis和redis整合 log4j打印sql语句

    首先,需要在项目中引进jedis-2.8.1.jar包,在pom.xml里加上 <dependency> <groupId>redis.clients</groupId& ...

  8. Django---Django的ORM的一对多操作(外键操作),ORM的多对多操作(关系管理对象),ORM的分组聚合,ORM的F字段查询和Q字段条件查询,Django的事务操作,额外(Django的终端打印SQL语句,脚本调试)

    Django---Django的ORM的一对多操作(外键操作),ORM的多对多操作(关系管理对象),ORM的分组聚合,ORM的F字段查询和Q字段条件查询,Django的事务操作,额外(Django的终 ...

  9. springboot打印sql语句及执行时间

    有时候我们程序的接口比较耗时,需要优化,这时我们可能需要了解该接口执行了哪些sql语句以及耗时 1.引入jar包 <!--监控sql日志--> <dependency> < ...

随机推荐

  1. 云链接 接口不允许 情况 解决方法 mysql Host is not allowed to connect to this MySQL server解决方法

    在装有MySQL的机器上登录MySQL mysql -u root -p密码 执行use mysql; 执行update user set host = '%' where user = 'root' ...

  2. leetcode-917-仅仅反转字母

    题目描述: 给定一个字符串 S,返回 “反转后的” 字符串,其中不是字母的字符都保留在原地,而所有字母的位置发生反转. 示例 1: 输入:"ab-cd" 输出:"dc-b ...

  3. Centos7下CPU内存等资源监控

    1.查看内存使用情况: [root@takeout web-takeout]# free -m total used free shared buff/cache available Mem: 378 ...

  4. webstorm 添加css前缀(兼容)自动添加

    Webstorm自动添加css前缀( 兼容) 百度了很多在webstorm中添加css前缀(兼容)自动添加,autoprefixer插件是首选,对于基本的css,还有less都支持,所以就选择了aut ...

  5. php如何使用rabbitmq实现发布消息和消费消息(一对多)(tp框架)(第二篇)

    一个publisher发布消息  多个个customer接受消息 1:准备工作参照: http://www.cnblogs.com/spicy/p/7886820.html 2,:路由: 3: 方法: ...

  6. 关于C++中操作符重载的疑问 :四个运算符=, -&gt;, [], ()不可以重载为全局函数(友员函数)

    转载自:http://blog.csdn.net/u014610226/article/details/47679323     以下是对C++中不能重载为友元函数的四个运算符进行了详细的分析介绍,需 ...

  7. Chapter 3 Phenomenon——2

    I had enough trouble not falling down when the ground was dry; it might be safer for me to go back t ...

  8. ELK构建MySQL慢日志收集平台详解

    上篇文章<中小团队快速构建SQL自动审核系统>我们完成了SQL的自动审核与执行,不仅提高了效率还受到了同事的肯定,心里美滋滋.但关于慢查询的收集及处理也耗费了我们太多的时间和精力,如何在这 ...

  9. 机器学习--集成学习(Ensemble Learning)

    一.集成学习法 在机器学习的有监督学习算法中,我们的目标是学习出一个稳定的且在各个方面表现都较好的模型,但实际情况往往不这么理想,有时我们只能得到多个有偏好的模型(弱监督模型,在某些方面表现的比较好) ...

  10. 面试:http协议

    转自:http://www.cnblogs.com/ranyonsue/p/5984001.html#undefined HTTP简介 HTTP协议是Hyper Text Transfer Proto ...