Coder Social home page Coder Social logo

stroboscope / lib_mysqludf_log Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mysqludf/lib_mysqludf_log

0.0 2.0 0.0 381 KB

A UDF library to write debug information to the log files.

License: GNU Lesser General Public License v2.1

Shell 97.20% C 2.80%

lib_mysqludf_log's Introduction

LIB_MYSQLUDF_LOG

Often it can be useful to write to a log file from inside a SQL statement or stored procedure. Currently this library contains only one function that allows you to write to the error log file.

This library lib_mysqludf_log can be used to write debug information to the log files. The following function is currently supported:

  • log_error - writes a line to the log.

Use lib_mysqludf_log_info() to obtain information about the currently installed version of lib_mysqludf_log.

Functions

###log_error(message)###

log_error writes the string argument as a new line to the error log. The log line is written for each call to log_error. The log is flushed after the completion of the statement containing the call to the log_error call. So, if log_error is used in a SELECT statement, the log messages may become visible after the SQL statement is executed. During execution, log message may become visible, but there is no guarantee that all messages are written until the statement finishes.

The location of the error log can be found using the following statement:

mysql> SHOW VARIABLES LIKE 'log_error';
+---------------+-------------------+
| Variable_name | Value             |
+---------------+-------------------+
| log_error     | ./mysql_error.log |
+---------------+-------------------+

A relative path for the error log locatoin, such as what is shown above, is resolved against the data directory. This can be found using the following statement:

mysql> SHOW VARIABLES LIKE 'datadir';
+---------------+----------------------+
| Variable_name | Value                |
+---------------+----------------------+
| datadir       | /opt/mysql/5.1/data/ |
+---------------+----------------------+

#####message##### The string message to be written to the error log. If message is not a string type, it is coerced into one. If message is NULL, the string NULL will be written. The message argument can be as long as you like, but only the first 9999 bytes will be written to the error log.

#####returns##### The return value should be 0 and has no significance.

####Examples####

SELECT log_error('whoops....');

lib_mysqludf_log's People

Contributors

jasny avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.