Author: carnold
Date: Fri Dec 15 14:06:40 2006
New Revision: 487688
URL: http://svn.apache.org/viewvc?view=rev&rev=487688
Log:
Bug 41169: NTEventLogAppender.dll missing event description
Removed:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/EventLogCategories.h
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/EventLogCategories.rc
Modified:
logging/log4j/branches/v1_2-branch/build.xml
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/EventLogCategories.mc
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/MSG00001.bin
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp
Modified: logging/log4j/branches/v1_2-branch/build.xml
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/v1_2-branch/build.xml?view=diff&rev=487688&r1=487687&r2=487688
==============================================================================
--- logging/log4j/branches/v1_2-branch/build.xml (original)
+++ logging/log4j/branches/v1_2-branch/build.xml Fri Dec 15 14:06:40 2006
@@ -343,14 +343,7 @@
destdir="${javac.dest}"
classpath="${jar.dest}/${jar.filename}"/>
- <exec executable="windres" dir="${java.source.dir}/org/apache/log4j/nt/">
- <arg value="-o"/>
- <arg file="${javac.dest}/EventLogCategories.o"/>
- <arg value="--include-dir=${javac.dest}"/>
- <arg
file="${java.source.dir}/org/apache/log4j/nt/EventLogCategories.rc"/>
- </exec>
-
- <exec executable="windres">
+ <exec executable="windres" dir="${java.source.dir}/org/apache/log4j/nt/">
<arg value="-o"/>
<arg file="${javac.dest}/NTEventLogAppender.o"/>
<arg file="${java.source.dir}org/apache/log4j/nt/NTEventLogAppender.rc"/>
@@ -367,7 +360,6 @@
<arg value="-shared"/>
<arg file="${java.source.dir}org/apache/log4j/nt/nteventlog.cpp"/>
<arg file="${javac.dest}/NTEventLogAppender.o"/>
- <arg file="${javac.dest}/EventLogCategories.o"/>
<arg value="-o"/>
<arg file="${jar.dest}/NTEventLogAppender.dll"/>
</exec>
Modified:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/EventLogCategories.mc
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/EventLogCategories.mc?view=diff&rev=487688&r1=487687&r2=487688
==============================================================================
---
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/EventLogCategories.mc
(original)
+++
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/EventLogCategories.mc
Fri Dec 15 14:06:40 2006
@@ -1,22 +1,44 @@
-MessageId=0xC350
+;
+; Licensed to the Apache Software Foundation (ASF) under one
+; or more contributor license agreements. See the NOTICE file
+; distributed with this work for additional information
+; regarding copyright ownership. The ASF licenses this file
+; to you under the Apache License, Version 2.0 (the
+; "License"); you may not use this file except in compliance
+; with the License. You may obtain a copy of the License at
+;
+; http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing,
+; software distributed under the License is distributed on an
+; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+; KIND, either express or implied. See the License for the
+; specific language governing permissions and limitations
+; under the License.
+;
+MessageId=1
Language=English
-Fatal
+Trace
.
-MessageId=0x9C40
+MessageId=2
Language=English
-Error
+Debug
+.
+MessageId=3
+Language=English
+Info
.
-MessageId=0x7530
+MessageId=4
Language=English
Warn
.
-MessageId=0x4E20
+MessageId=5
Language=English
-Info
+Error
.
-MessageId=0x2710
+MessageId=6
Language=English
-Debug
+Fatal
.
MessageId=0x1000
Language=English
Modified:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/MSG00001.bin
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/MSG00001.bin?view=diff&rev=487688&r1=487687&r2=487688
==============================================================================
Binary files - no diff available.
Modified:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc?view=diff&rev=487688&r1=487687&r2=487688
==============================================================================
---
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
(original)
+++
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
Fri Dec 15 14:06:40 2006
@@ -1,3 +1,26 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+//
+// Message file include
+//
+LANGUAGE 0x9,0x1
+1 11 MSG00001.bin
// Microsoft Visual C++ generated resource script.
//
#include "windows.h"
@@ -53,8 +76,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1, 2, 14, 1
- PRODUCTVERSION 1, 2, 14, 1
+ FILEVERSION 1, 2, 15, 1
+ PRODUCTVERSION 1, 2, 15, 1
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -71,12 +94,12 @@
BEGIN
VALUE "CompanyName", "Apache Software Foundation"
VALUE "FileDescription", "Platform methods for NTEventLogAppender"
- VALUE "FileVersion", "1, 2, 14, 1"
+ VALUE "FileVersion", "1, 2, 15, 1"
VALUE "InternalName", "NTEventLogAppender"
VALUE "LegalCopyright", "Copyright (C) 2005, Apache Software
Foundation"
VALUE "OriginalFilename", "NTEventLogAppender.dll"
VALUE "ProductName", "log4j"
- VALUE "ProductVersion", "1, 2, 14, 1"
+ VALUE "ProductVersion", "1, 2, 15, 1"
END
END
BLOCK "VarFileInfo"
Modified:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp
URL:
http://svn.apache.org/viewvc/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp?view=diff&rev=487688&r1=487687&r2=487688
==============================================================================
---
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp
(original)
+++
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp
Fri Dec 15 14:06:40 2006
@@ -33,8 +33,23 @@
* be displayed in the NT Event Viewer.
*/
WORD getCategory(jint priority) {
- // Priority values map directly to EventLog category values
- return (WORD)(priority + 1);
+ WORD category = 1;
+ if (priority >= org_apache_log4j_Priority_DEBUG_INT) {
+ category = 2;
+ if (priority >= org_apache_log4j_Priority_INFO_INT) {
+ category = 3;
+ if (priority >= org_apache_log4j_Priority_WARN_INT) {
+ category = 4;
+ if (priority >= org_apache_log4j_Priority_ERROR_INT) {
+ category = 5;
+ if (priority >= org_apache_log4j_Priority_FATAL_INT) {
+ category = 6;
+ }
+ }
+ }
+ }
+ }
+ return category;
}
/*
@@ -43,23 +58,17 @@
* 3 event types of interest to us: ERROR, WARNING, and INFO.
*/
WORD getType(jint priority) {
- WORD ret_val;
-
- switch (priority) {
- case org_apache_log4j_Priority_FATAL_INT:
- case org_apache_log4j_Priority_ERROR_INT:
- ret_val = EVENTLOG_ERROR_TYPE;
- break;
- case org_apache_log4j_Priority_WARN_INT:
- ret_val = EVENTLOG_WARNING_TYPE;
- break;
- case org_apache_log4j_Priority_INFO_INT:
- case org_apache_log4j_Priority_DEBUG_INT:
- default:
- ret_val = EVENTLOG_INFORMATION_TYPE;
- break;
+ WORD type = EVENTLOG_SUCCESS;
+ if (priority >= org_apache_log4j_Priority_INFO_INT) {
+ type = EVENTLOG_INFORMATION_TYPE;
+ if (priority >= org_apache_log4j_Priority_WARN_INT) {
+ type = EVENTLOG_WARNING_TYPE;
+ if (priority >= org_apache_log4j_Priority_ERROR_INT) {
+ type = EVENTLOG_ERROR_TYPE;
+ }
+ }
}
- return ret_val;
+ return type;
}
HKEY regGetKey(wchar_t *subkey, DWORD *disposition) {
@@ -71,7 +80,8 @@
}
void regSetString(HKEY hkey, wchar_t *name, wchar_t *value) {
- RegSetValueExW(hkey, name, 0, REG_SZ, (LPBYTE)value, (wcslen(value) + 1) *
sizeof(wchar_t));
+ RegSetValueExW(hkey, name, 0, REG_EXPAND_SZ,
+ (LPBYTE)value, (wcslen(value) + 1) * sizeof(wchar_t));
}
void regSetDword(HKEY hkey, wchar_t *name, DWORD value) {
@@ -91,15 +101,19 @@
wcscat(subkey, source);
hkey = regGetKey(subkey, &disposition);
if (disposition == REG_CREATED_NEW_KEY) {
- regSetString(hkey, L"EventMessageFile", L"NTEventLogAppender.dll");
- regSetString(hkey, L"CategoryMessageFile", L"NTEventLogAppender.dll");
+ HMODULE hmodule = GetModuleHandleW(L"NTEventLogAppender.dll");
+ if (hmodule != NULL) {
+ wchar_t modpath[_MAX_PATH];
+ DWORD modlen = GetModuleFileNameW(hmodule, modpath, _MAX_PATH - 1);
+ if (modlen > 0) {
+ modpath[modlen] = 0;
+ regSetString(hkey, L"EventMessageFile", modpath);
+ regSetString(hkey, L"CategoryMessageFile", modpath);
+ }
+ }
regSetDword(hkey, L"TypesSupported", (DWORD)7);
- regSetDword(hkey, L"CategoryCount", (DWORD)8);
+ regSetDword(hkey, L"CategoryCount", (DWORD) 6);
}
- //RegSetValueEx(hkey, "EventMessageFile", 0, REG_SZ, (LPBYTE)dllname,
lstrlen(dllname));
- //RegSetValueEx(hkey, "CategoryMessageFile", 0, REG_SZ,
(LPBYTE)dllname, lstrlen(dllname));
- //RegSetValueEx(hkey, "TypesSupported", 0, REG_DWORD,
(LPBYTE)&whichTypes, sizeof(DWORD));
- //RegSetValueEx(hkey, "CategoryCount", 0, REG_DWORD,
(LPBYTE)&numCategories, sizeof(DWORD));
RegCloseKey(hkey);
return;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]