Mybatis source code parsing - Logs


Adapter mode

Mybatis own set of unified logging and for the upper use, use the adapter mode provides adapters for common logging framework


Logging component is responsible for creating the corresponding adapter, the static initialization block will be loaded in order to load each log adapter components, and use the first load of logs to component adapter to save logConstructorthis static field

JDBC debug log

BaseJdbcLoggerBind SQL parameters related to the recording of the set, and a method name associated with the implementation of the SQL statement
ConnectionLoggerencapsulates Connectionan object while achieving InvocationHandlerthe object, its newInstance()method will encapsulate its Connectionobject is to create a proxy object. Which invoke()method prepareStatement(),prepaerCall(),createStatement()provides agents and other methods, in particular creates a corresponding Statement object and proxy object to call these methods and return the proxy.
PreparedStatementLogger,StatementLogger,ResultSetLoggerThe newInstance()methods are similar, their invoke()method will add a log to print their corresponding methods of function

Published 98 original articles · won praise 9 · views 10000 +

Guess you like