eventlog fix
Hello,
The purpose of this patch is to fix an error when log_destination is set to
'eventlog' value in postgresql.conf files.
If you launch postmaster and see after fir log in windows event report
tools, you will see an error message with postgresql message like that :
Sorry for this French copy screen, the error message is: description for id
event #0 is missing for PostgreSQL source.
To fix the error it is mandatory to describe and register a message with an
ID set to 0. The message is declared in a MC file whish need to be compiled
by MC compiler. The MC compiler is part of core SDK and is not available
with Msys tools but can be freely downloaded from Microsoft web site, so I
suggest storing in CVS msg00001.bin a bin file result of MC compiler.
The rest of DLL is functions to allow setup program to register/unregister
DLL to windows registry database after copy it in it's target directory.
(regsvr32 pgevent.dll to register, regsvr32 /u pgevent.dll to unregister
it).
After discussion on win32 mailing list, I suggest to store source under
src/bin/pg_event
regards,
Laurent Ballester
The purpose of this patch is to fix an error when
log_destination is set to 'eventlog' value in postgresql.conf files.
Looks good to me, just a couple of tiny things:
<snip>
After discussion on win32 mailing list, I suggest to store
source under src/bin/pg_event
I assume you mean src/bin/pgevent, to be consistent with the naming used
inside the program.
Second, I'd register the source as "PostgreSQL", not "PostGreSQL". I
don't think the "captital-G" is generally used, and it's specifically
NOT what the backend uses. Sure, the key reading process is
case-insensitive today, but it's still a good idea to keep things
consistent :-)
(Actually, this goes for the error msgs as well)
Finally, I'd also move the GetModuleFilename() call to before
RegCreateKey(). In the (very rare) case that it would fail, you don't
want to alerady have created the registry key.
//Magnus
Import Notes
Resolved by subject fallback
Hello magnus,
I assume you mean src/bin/pgevent, to be consistent with the naming used
inside the program.
OK, I Modify Makefile subdir value. In fact I name it pg_event because many
directory under src/bin began with pg_ .
Second, I'd register the source as "PostgreSQL", not "PostGreSQL". I
don't think the "captital-G" is generally used, and it's specifically
NOT what the backend uses. Sure, the key reading process is
case-insensitive today, but it's still a good idea to keep things
consistent :-)
I modify pgevent.c, for your both remarks: "capital G" are disappears from
source and I move GetModuleFilename() before RegCreateKey() call.
I sent full set file again, it will be easier to apply.
regards,
Laurent
On Thu, Jun 03, 2004 at 12:33:29AM +0200, Laurent Ballester wrote:
I modify pgevent.c, for your both remarks: "capital G" are disappears from
source and I move GetModuleFilename() before RegCreateKey() call.I sent full set file again, it will be easier to apply.
/* Global variables */
HANDLE g_hModule = NULL; /* hModule of DLL */
We don't use this hungarian notation anywhere ... it certainly looks
ugly.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Y eso te lo doy firmado con mis l�grimas" (Fiebre del Loco)
Hello,
We don't use this hungarian notation anywhere ... it certainly looks
ugly.
Sorry, I modify pgevent.c again and suppress all hungarian variables naming.
I add a diff -c for src/bin/Makefile, necessary to compile pgevent for
windows platform.
regards
Laurent Ballester
Would you send me documentation explaining how to register this DLL with
the event logger on Win32? Ideally you could send me a diff against
installation.sgml.
---------------------------------------------------------------------------
Laurent Ballester wrote:
Hello,
We don't use this hungarian notation anywhere ... it certainly looks
ugly.Sorry, I modify pgevent.c again and suppress all hungarian variables naming.
I add a diff -c for src/bin/Makefile, necessary to compile pgevent for
windows platform.regards
Laurent Ballester
[ Attachment, skipping... ]
[ Attachment, skipping... ]
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Would you send me documentation explaining how to register this DLL with
the event logger on Win32? Ideally you could send me a diff against
installation.sgml.
Hello Bruce,
After the DLL was in it target directory (C:\msys\1.0\local\pgsql\lib with
make install)
You can register the DLL to windows event log with the command
Regsvr32 pgevent.dll or regsvr32 /s pgevent.dll whish is a silent mode.
To uninstall, regsvr32 /u pgevent.dll will delete key add by the DLL in
Windows registry.
The DLL create the following entry:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\P
ostgreSQL] with two values :
EventMessageFile wish contains full path of DLL
C:\msys\1.0\local\pgsql\lib\pgevent.dll
TypesSupported : error type message send by postgresql
Regsvr32 is a standard program located in %systemroot%\system32
Regards
Laurent Ballester
OK, I have created the following diff to document the pgevent
installation instructions. However, you didn't send me a Makefile for
creating the DLL, and I am not sure how to do that. Would you send me a
`Makefile for src/bin/pgevent? Thanks.
---------------------------------------------------------------------------
Laurent Ballester wrote:
Hello,
We don't use this hungarian notation anywhere ... it certainly looks
ugly.Sorry, I modify pgevent.c again and suppress all hungarian variables naming.
I add a diff -c for src/bin/Makefile, necessary to compile pgevent for
windows platform.regards
Laurent Ballester
[ Attachment, skipping... ]
[ Attachment, skipping... ]
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Attachments:
/pgpatches/pgevent.difftext/plainDownload+16-0
Hello,
I just looking under CVS web interface what is stored in pgevent directory
and what is missing.
The files attached with this mail have to be stored in pgevent directory.
MSG000001.bin is a bin files, result of Microsoft MC compiler. MC compiler
can be downloaded for free with MS Core SDK but it is not included with MSYS
tools and I didn't find a alternative way to compile MC file.
To summarize MC pgmsgevent.mc command generates pgmsgevent.h pgmsgevent.rc
and MSG00001.bin files.
In MC file, we declare a string with %s format, so we can write anything we
want in the future without need to change the definition of this string.
To finish, because DllUnregisterServer and DllRegisterServer are system
defined entry point, we need to export these two functions with their names
without "decoration", so we cannot uses auto generated .def files without
handy modifications.
regards
Laurent Ballester
----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Laurent Ballester" <postgresql.ballester@wanadoo.fr>
Cc: "Alvaro Herrera" <alvherre@dcc.uchile.cl>;
<pgsql-patches@postgresql.org>
Sent: Saturday, June 19, 2004 7:13 AM
Subject: Re: [PATCHES] eventlog fix
Show quoted text
OK, I have created the following diff to document the pgevent
installation instructions. However, you didn't send me a Makefile for
creating the DLL, and I am not sure how to do that. Would you send me a
`Makefile for src/bin/pgevent? Thanks.
Woh, we aren't requring MS C to compile this feature. Can't it be
created by mingw? If not, I don't see what value an MS C compile is
going to do for us.
---------------------------------------------------------------------------
Laurent Ballester wrote:
Hello,
I just looking under CVS web interface what is stored in pgevent directory
and what is missing.The files attached with this mail have to be stored in pgevent directory.
MSG000001.bin is a bin files, result of Microsoft MC compiler. MC compiler
can be downloaded for free with MS Core SDK but it is not included with MSYS
tools and I didn't find a alternative way to compile MC file.To summarize MC pgmsgevent.mc command generates pgmsgevent.h pgmsgevent.rc
and MSG00001.bin files.
In MC file, we declare a string with %s format, so we can write anything we
want in the future without need to change the definition of this string.To finish, because DllUnregisterServer and DllRegisterServer are system
defined entry point, we need to export these two functions with their names
without "decoration", so we cannot uses auto generated .def files without
handy modifications.regards
Laurent Ballester----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Laurent Ballester" <postgresql.ballester@wanadoo.fr>
Cc: "Alvaro Herrera" <alvherre@dcc.uchile.cl>;
<pgsql-patches@postgresql.org>
Sent: Saturday, June 19, 2004 7:13 AM
Subject: Re: [PATCHES] eventlog fixOK, I have created the following diff to document the pgevent
installation instructions. However, you didn't send me a Makefile for
creating the DLL, and I am not sure how to do that. Would you send me a
`Makefile for src/bin/pgevent? Thanks.
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
We require the MS "MC" compiler to build the BIN file (note - this is
not C - this is the "Message Compiler"). The Ccode should compile fine
in mingw.
Not requiring it is the reason we'd include the .BIN file in CVS. MC is
only needed to *rebuild* it.
//Magnus
Show quoted text
-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]Woh, we aren't requring MS C to compile this feature. Can't it be
created by mingw? If not, I don't see what value an MS C compile is
going to do for us.---------------------------------------------------------------
------------Laurent Ballester wrote:
Hello,
I just looking under CVS web interface what is stored in
pgevent directory
and what is missing.
The files attached with this mail have to be stored in
pgevent directory.
MSG000001.bin is a bin files, result of Microsoft MC
compiler. MC compiler
can be downloaded for free with MS Core SDK but it is not
included with MSYS
tools and I didn't find a alternative way to compile MC file.
To summarize MC pgmsgevent.mc command generates pgmsgevent.h
pgmsgevent.rc
and MSG00001.bin files.
In MC file, we declare a string with %s format, so we canwrite anything we
want in the future without need to change the definition of
this string.
To finish, because DllUnregisterServer and DllRegisterServer
are system
defined entry point, we need to export these two functions
with their names
without "decoration", so we cannot uses auto generated .def
files without
handy modifications.
regards
Laurent Ballester----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Laurent Ballester" <postgresql.ballester@wanadoo.fr>
Cc: "Alvaro Herrera" <alvherre@dcc.uchile.cl>;
<pgsql-patches@postgresql.org>
Sent: Saturday, June 19, 2004 7:13 AM
Subject: Re: [PATCHES] eventlog fixOK, I have created the following diff to document the pgevent
installation instructions. However, you didn't send me aMakefile for
creating the DLL, and I am not sure how to do that. Would
you send me a
`Makefile for src/bin/pgevent? Thanks.
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073---------------------------(end of
broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org
Import Notes
Resolved by subject fallback
There is also this message compiler - I have no idea of the quality:
http://www.volny.cz/xnavara/SimpleMC.zip
I believe the WINE project also has one.
Putting the .bin file in CVS doesn't seem too horrible to me.
cheers
andrew
Magnus Hagander wrote:
Show quoted text
We require the MS "MC" compiler to build the BIN file (note - this is
not C - this is the "Message Compiler"). The Ccode should compile fine
in mingw.Not requiring it is the reason we'd include the .BIN file in CVS. MC is
only needed to *rebuild* it.//Magnus
-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]Woh, we aren't requring MS C to compile this feature. Can't it be
created by mingw? If not, I don't see what value an MS C compile is
going to do for us.---------------------------------------------------------------
------------Laurent Ballester wrote:
Hello,
I just looking under CVS web interface what is stored in
pgevent directory
and what is missing.
The files attached with this mail have to be stored in
pgevent directory.
MSG000001.bin is a bin files, result of Microsoft MC
compiler. MC compiler
can be downloaded for free with MS Core SDK but it is not
included with MSYS
tools and I didn't find a alternative way to compile MC file.
To summarize MC pgmsgevent.mc command generates pgmsgevent.h
pgmsgevent.rc
and MSG00001.bin files.
In MC file, we declare a string with %s format, so we canwrite anything we
want in the future without need to change the definition of
this string.
To finish, because DllUnregisterServer and DllRegisterServer
are system
defined entry point, we need to export these two functions
with their names
without "decoration", so we cannot uses auto generated .def
files without
handy modifications.
regards
Laurent Ballester----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Laurent Ballester" <postgresql.ballester@wanadoo.fr>
Cc: "Alvaro Herrera" <alvherre@dcc.uchile.cl>;
<pgsql-patches@postgresql.org>
Sent: Saturday, June 19, 2004 7:13 AM
Subject: Re: [PATCHES] eventlog fixOK, I have created the following diff to document the pgevent
installation instructions. However, you didn't send me aMakefile for
creating the DLL, and I am not sure how to do that. Would
you send me a
`Makefile for src/bin/pgevent? Thanks.
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073---------------------------(end of
broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
-----Original Message-----
From: pgsql-patches-owner@postgresql.org on behalf of Bruce Momjian
Sent: Sat 6/19/2004 4:21 PM
To: Laurent Ballester
Cc: Alvaro Herrera; pgsql-patches@postgresql.org
Subject: Re: [PATCHES] eventlog fixWoh, we aren't requring MS C to compile this feature. Can't it be
created by mingw? If not, I don't see what value an MS C compile is
going to do for us.
Mingw will not compile the message file, and without it there is no way of getting event log messages that aren't so messy that they're virtually unreadable.
Regards, Dave
Import Notes
Resolved by subject fallback
"Magnus Hagander" <mha@sollentuna.net> writes:
We require the MS "MC" compiler to build the BIN file (note - this is
not C - this is the "Message Compiler").
So is this tool readily available? What does one have to do/buy to
lay hands on it?
Not requiring it is the reason we'd include the .BIN file in CVS. MC is
only needed to *rebuild* it.
I'd prefer to avoid having derived files like this in CVS. We do not
keep any other derived files in CVS (except configure, which decision
seems more and more like a historical artifact).
regards, tom lane
-----Original Message-----
From: pgsql-patches-owner@postgresql.org
[mailto:pgsql-patches-owner@postgresql.org] On Behalf Of Tom Lane
Sent: 19 June 2004 20:03
To: Magnus Hagander
Cc: Bruce Momjian; Laurent Ballester; pgsql-patches@postgresql.org
Subject: Re: [PATCHES] eventlog fix"Magnus Hagander" <mha@sollentuna.net> writes:
We require the MS "MC" compiler to build the BIN file (note
- this is
not C - this is the "Message Compiler").
So is this tool readily available? What does one have to
do/buy to lay hands on it?
Download it from
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ (dunno how
that'll render outside of IE - it's part of an active setup thingy).
It's included with the Windows Platform SDK (which is free).
Not requiring it is the reason we'd include the .BIN file
in CVS. MC
is only needed to *rebuild* it.
I'd prefer to avoid having derived files like this in CVS.
We do not keep any other derived files in CVS (except
configure, which decision seems more and more like a
historical artifact).
It's a very large download to get the SDK (180MB) - that's a lot of
bandwidth for one little derived file that will almost certainly never
change.
Regards, Dave.
Import Notes
Resolved by subject fallback
"Dave Page" <dpage@vale-housing.co.uk> writes:
So is this tool readily available? What does one have to
do/buy to lay hands on it?
It's included with the Windows Platform SDK (which is free).
Oh, good.
It's a very large download to get the SDK (180MB) - that's a lot of
bandwidth for one little derived file that will almost certainly never
change.
Hm, that is a lot ... but wouldn't the sort of people interested in
hacking PG on Windows likely already have it?
If you think not, I'll withdraw my objection to keeping the .BIN in CVS,
but I'm just wondering whether we're worrying about something that
hackers would have anyway.
regards, tom lane
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 19 June 2004 22:49
To: Dave Page
Cc: Magnus Hagander; Bruce Momjian; Laurent Ballester;
pgsql-patches@postgresql.org
Subject: Re: [PATCHES] eventlog fixHm, that is a lot ... but wouldn't the sort of people
interested in hacking PG on Windows likely already have it?If you think not, I'll withdraw my objection to keeping the
.BIN in CVS, but I'm just wondering whether we're worrying
about something that hackers would have anyway.
I have mc.exe, but only because I have paid for Visual Studio. I don't
have the platform SDK installed, however I cannot honestly say whether
or not I would have it if I didn't have VS. I would include the file in
CVS if it were my choice - it's clearly a pain to download the compiler
if you don't have it, and the file is unlikely to need updating in the
future - it was designed to be a generic DLL that just formats any
message as '%s'.
Regards Dave.
Import Notes
Resolved by subject fallback
Dave Page wrote:
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 19 June 2004 22:49
To: Dave Page
Cc: Magnus Hagander; Bruce Momjian; Laurent Ballester;
pgsql-patches@postgresql.org
Subject: Re: [PATCHES] eventlog fixHm, that is a lot ... but wouldn't the sort of people
interested in hacking PG on Windows likely already have it?If you think not, I'll withdraw my objection to keeping the
.BIN in CVS, but I'm just wondering whether we're worrying
about something that hackers would have anyway.I have mc.exe, but only because I have paid for Visual Studio. I don't
have the platform SDK installed, however I cannot honestly say whether
or not I would have it if I didn't have VS. I would include the file in
CVS if it were my choice - it's clearly a pain to download the compiler
if you don't have it, and the file is unlikely to need updating in the
future - it was designed to be a generic DLL that just formats any
message as '%s'.
Agreed. We have to include the .bin file because if we don't, we would
have an additional Win32 depenency beyond Mingw.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Patch applied, with doc additions I already posted. Please test CVS and
let me know how it works. I added a README containing your explaination
below for our later reference. I added the MSG000001.bin as a binary
CVS checkin.
---------------------------------------------------------------------------
Laurent Ballester wrote:
Hello,
I just looking under CVS web interface what is stored in pgevent directory
and what is missing.The files attached with this mail have to be stored in pgevent directory.
MSG000001.bin is a bin files, result of Microsoft MC compiler. MC compiler
can be downloaded for free with MS Core SDK but it is not included with MSYS
tools and I didn't find a alternative way to compile MC file.To summarize MC pgmsgevent.mc command generates pgmsgevent.h pgmsgevent.rc
and MSG00001.bin files.
In MC file, we declare a string with %s format, so we can write anything we
want in the future without need to change the definition of this string.To finish, because DllUnregisterServer and DllRegisterServer are system
defined entry point, we need to export these two functions with their names
without "decoration", so we cannot uses auto generated .def files without
handy modifications.regards
Laurent Ballester----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Laurent Ballester" <postgresql.ballester@wanadoo.fr>
Cc: "Alvaro Herrera" <alvherre@dcc.uchile.cl>;
<pgsql-patches@postgresql.org>
Sent: Saturday, June 19, 2004 7:13 AM
Subject: Re: [PATCHES] eventlog fixOK, I have created the following diff to document the pgevent
installation instructions. However, you didn't send me a Makefile for
creating the DLL, and I am not sure how to do that. Would you send me a
`Makefile for src/bin/pgevent? Thanks.
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
[ Attachment, skipping... ]
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Hello,
I downloaded and compiled all files you store in CVS pgevent directory and
it works.
Following the discusion posted yesterday, I made a test with SimpleMC a
alternative MC compiler ( http://www.volny.cz/xnavara/SimpleMC.zip) but
unfortunatelly it doesn't works MSG0001.bin file generated are differents
and consequently Messages are seing missing for Windows eventviewer.
regards
Laurent Ballester
----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Laurent Ballester" <postgresql.ballester@wanadoo.fr>
Cc: "Alvaro Herrera" <alvherre@dcc.uchile.cl>;
<pgsql-patches@postgresql.org>
Sent: Sunday, June 20, 2004 3:33 AM
Subject: Re: [PATCHES] eventlog fix
Show quoted text
Patch applied, with doc additions I already posted. Please test CVS and
let me know how it works. I added a README containing your explaination
below for our later reference. I added the MSG000001.bin as a binary
CVS checkin.