Re: Using fprintf or DBUG_PRINT to print messages in mysqld

Thomas Jones-Low <[email protected]>
Newsgroups gmane.comp.db.mysql.devel
Organization Akiban Technologies
Message-ID <[email protected]>
On 9/5/2011 3:43 AM, Salil Bhagurkar wrote:
> Hello All,
>
> I am trying to understand the code flow of mysql-5.5.15 mysqld server.
>
> 1. I am able to use fprintf(stdout, ..) to print out messages to the
> console in the main startup code of mysqld.
>
> 2. I cannot use fprintf in any of the thread context to print messages
> to the console. Why is this?
>
	The MySQL logging system redirects both stdout and stderr to the MySQL 
log file. use tail -f /var/log/mysql.log to see your messages.

> 3. If I compile the source code with the debug option and use
> DBUG_PRINT, then it does not work in some cases, specifically in the
> function do_handle_one_connection() in sql/sql_connect.cc.
>
> 4. DBUG_PRINT works and is used in the function do_command which is
> called by the do_handle_one_connection() method. From what I observed,
> is DBUG_ENTER always required to be able to DBUG_PRINT?
>
	Yes, and DEBUG_RETURN() or DBUG_VOID_RETURN; These are macros, each of 
which sets (or clears) some global state. They must be used together.

-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.