Commit 39f19505 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-19068 - rename eventlog source to MariaDB.

parent 8d27f1e4
No preview for this file type
...@@ -2449,7 +2449,7 @@ static void setup_windows_event_source() ...@@ -2449,7 +2449,7 @@ static void setup_windows_event_source()
// Create the event source registry key // Create the event source registry key
dwError= RegCreateKey(HKEY_LOCAL_MACHINE, dwError= RegCreateKey(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL", "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MariaDB",
&hRegKey); &hRegKey);
/* Name of the PE module that contains the message resource */ /* Name of the PE module that contains the message resource */
...@@ -8697,18 +8697,35 @@ bool flush_error_log() ...@@ -8697,18 +8697,35 @@ bool flush_error_log()
} }
#ifdef _WIN32 #ifdef _WIN32
struct eventlog_source
{
HANDLE handle;
eventlog_source()
{
setup_windows_event_source();
handle = RegisterEventSource(NULL, "MariaDB");
}
~eventlog_source()
{
if (handle)
DeregisterEventSource(handle);
}
};
static eventlog_source eventlog;
static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
size_t length, size_t buffLen) size_t length, size_t buffLen)
{ {
HANDLE event; HANDLE event= eventlog.handle;
char *buffptr= buff; char *buffptr= buff;
DBUG_ENTER("print_buffer_to_nt_eventlog"); DBUG_ENTER("print_buffer_to_nt_eventlog");
/* Add ending CR/LF's to string, overwrite last chars if necessary */ /* Add ending CR/LF's to string, overwrite last chars if necessary */
strmov(buffptr+MY_MIN(length, buffLen-5), "\r\n\r\n"); strmov(buffptr+MY_MIN(length, buffLen-5), "\r\n\r\n");
setup_windows_event_source(); if (event)
if ((event= RegisterEventSource(NULL,"MySQL")))
{ {
switch (level) { switch (level) {
case ERROR_LEVEL: case ERROR_LEVEL:
...@@ -8724,7 +8741,6 @@ static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, ...@@ -8724,7 +8741,6 @@ static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
0, (LPCSTR*) &buffptr, NULL); 0, (LPCSTR*) &buffptr, NULL);
break; break;
} }
DeregisterEventSource(event);
} }
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
#ifndef MESSAGE_INCLUDED
#define MESSAGE_INCLUDED
/* Copyright (c) 2008, 2009 Sun Microsystems, Inc.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
/* /*
To change or add messages mysqld writes to the Windows error log, run To change or add messages mysqld writes to the Windows error log, run
mc.exe message.mc mc.exe message.mc
...@@ -24,10 +6,8 @@ ...@@ -24,10 +6,8 @@
mc.exe can be installed with Windows SDK, some Visual Studio distributions mc.exe can be installed with Windows SDK, some Visual Studio distributions
do not include it. do not include it.
*/ */
// //
// Values are 32 bit values layed out as follows: // Values are 32 bit values laid out as follows:
// //
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
...@@ -67,11 +47,8 @@ ...@@ -67,11 +47,8 @@
// //
// MessageText: // MessageText:
// //
// %1For more information, see Help and Support Center at http://www.mysql.com. // %1
// //
//
// //
#define MSG_DEFAULT 0xC0000064L #define MSG_DEFAULT 0xC0000064L
#endif /* MESSAGE_INCLUDED */
...@@ -11,6 +11,5 @@ Severity = Error ...@@ -11,6 +11,5 @@ Severity = Error
Facility = Application Facility = Application
SymbolicName = MSG_DEFAULT SymbolicName = MSG_DEFAULT
Language = English Language = English
%1For more information, see Help and Support Center at http://www.mysql.com. %1
LANGUAGE 0x9,0x1 LANGUAGE 0x9,0x1
1 11 MSG00001.bin 1 11 "MSG00001.bin"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment