2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00
chenglch 580b399ade Add trace log in db subroutines (#3666)
This patch add trace log for the db access. Currently support
5 log levels:
- 0: disable the trace log for db.
- 1: trace the calls of database subroutines.
- 2: trace the event to build the cache for the table
- 3: trace the event with cache hit
- 4: trace the SQL statement

implement-feature: #3612

Output example from xcat/cluster.log:
···
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end","elapsed":"0.00176s"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"start"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"value\" = ? AND \"comments\" = ? AND \"disable\" = ? AND \"key\" = ?","table":"site","method":"xCAT::Table::setAttribs"},"type":"start_sql"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end_sql","elapsed":"0.00043s"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"INSERT INTO site (\"value\",\"comments\",\"key\",\"disable\") VALUES (?,?,?,?)","table":"site","method":"xCAT::Table::setAttribs"},"type":"start_sql"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"INSERT INTO site (\"value\",\"comments\",\"key\",\"disable\") VALUES (?,?,?,?)","table":"site","method":"xCAT::Table::setAttribs"},"type":"end_sql","elapsed":"0.00043s"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::setAttribs"},"type":"end","elapsed":"0.00171s"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"start"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"key\" = ? and (\"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO'))","table":"site","method":"xCAT::Table::getAttribs"},"type":"start_sql"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"end_sql","elapsed":"0.00061s"}
Aug  9 01:59:15 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAttribs"},"type":"end","elapsed":"0.00125s"}
Aug  9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"table":"site","method":"xCAT::Table::getAllAttribs"},"type":"start"}
Aug  9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO')","table":"site","method":"xCAT::Table::getAllAttribs"},"type":"start_sql"}
Aug  9 01:59:19 c910f05c01bc02k74 xcat[694]: [DB Trace]: {"msg":{"addon":"SELECT * FROM site WHERE \"disable\" is NULL or \"disable\" in ('0','no','NO','No','nO')","table":"site","method":"xCAT::Table::getAllAttribs"},"type":"end_sql","elapsed":"0.00080s"}
···
2017-08-14 21:35:33 -05:00
2017-03-14 11:27:56 -04:00
2017-08-10 02:16:37 -04:00
2017-08-10 06:27:25 -04:00

xCAT
----

xCAT is a toolkit for the deployment and administration of clusters.

Documentation
-------------

xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/

|docs_latest| |docs_2136| |docs_2135| |docs_2134| |docs_2133| |docs_2132| |docs_2131| |docs_2130| |docs_212|

Open Source License
-------------------

xCAT is made available as open source software under the EPL license:
http://www.opensource.org/licenses/eclipse-1.0.php

Developers
----------

Developers and prospective contributors are encouraged to read the `Developers Guide <http://xcat-docs.readthedocs.io/en/latest/developers/>`_
In particular the `GitHub <http://xcat-docs.readthedocs.io/en/latest/developers/github/>`_ related subsection.

.. |docs_2136| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.6
    :alt: 2.13.6 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.13.6/

.. |docs_2135| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.5
    :alt: 2.13.5 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.13.5/

.. |docs_2134| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.4
    :alt: 2.13.4 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.13.4/

.. |docs_2133| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.3
    :alt: 2.13.3 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.13.3/
    
.. |docs_2132| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.2
    :alt: 2.13.2 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.13.2/

.. |docs_2131| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.1
    :alt: 2.13.1 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.13.1/

.. |docs_2130| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.0
    :alt: 2.13.0 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.13.0/
    
.. |docs_212| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.12
    :alt: 2.12 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.12/
        
.. |docs_211| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.11
    :alt: 2.11 documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/2.11/
    
.. |docs_latest| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=latest
    :alt: Latest documentation status
    :scale: 100%
    :target: http://xcat-docs.readthedocs.io/en/latest/
Description
No description provided
Readme EPL-1.0 230 MiB
Languages
Perl 78.5%
Shell 11.4%
JavaScript 7.1%
Python 1.8%
PHP 0.4%
Other 0.4%