[prev in list] [next in list] [prev in thread] [next in thread]
List: postgresql-general
Subject: Re: Function for Exception Logging
From: Tony Shelver <tshelver () gmail ! com>
Date: 2018-10-31 6:45:15
Message-ID: CAG0dhZA3j2sAqm9+9oE_biFojpQ3Y9AR=aGGrBjLCED5csJEGQ () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I'd be interested if there is an answer to this. The big issue with
writing to a table is the interaction with rollbacks and commits.
Even more difficult in PG functions as they have no commit / rollback
capability. I haven't played with stored procedures in in PG11 yet.
In Oracle, I wrote logging / error messages to a logging file on the fire
system, directly from PL/SQL.
This file can then be monitored for error messages via a messaging
solutions.
Regards
On Mon, 29 Oct 2018 at 19:13, Patrick FICHE <Patrick.Fiche@aqsacom.com>
wrote:
> Hi community,
>
>
>
> I would like to implement a function that would log managed Exceptions
> into a dedicated table.
>
> For example, I have some code like :
>
> BEGIN
>
> Code generation exception
>
> EXCEPTION
>
> WHEN OTHERS THEN Log_Error();
>
> END;
>
>
>
> The Log_Error function would be able to get the exception context /
> parameters to log the exception parameters into a table.
>
> Is there any way to manage this without providing the Exception parameters
> as parameters to the Log_Error function ?
>
>
>
> Thanks,
>
> Patrick
>
>
>
>
>
> *Patrick Fiche*
>
> Database Engineer, Aqsacom Sas.
>
> *c.* 33 6 82 80 69 96
>
> *e.* patrick.fiche@aqsacom.com
>
>
>
> [image: 01-03_AQSA_Main_Corporate_Logo_JPEG_White_Low.jpg]
> <http://www.aqsacom.com/>
>
>
>
[Attachment #5 (text/html)]
<div dir="ltr">I'd be interested if there is an answer to this. The big issue \
with writing to a table is the interaction with rollbacks and \
commits.<div><br></div><div>Even more difficult in PG functions as they have no \
commit / rollback capability. I haven't played with stored procedures in in \
PG11 yet.</div><div><br></div><div>In Oracle, I wrote logging / error messages to a \
logging file on the fire system, directly from \
PL/SQL.</div><div><br></div><div><br></div><div>This file can then be monitored for \
error messages via a messaging \
solutions.</div><div><br></div><div><br></div><div>Regards</div><div><br></div><div><br></div></div><br><div \
class="gmail_quote"><div dir="ltr">On Mon, 29 Oct 2018 at 19:13, Patrick FICHE <<a \
href="mailto:Patrick.Fiche@aqsacom.com">Patrick.Fiche@aqsacom.com</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_-3929912706139619807WordSection1">
<p class="MsoNormal"><span style="font-family:"Cambria",serif">Hi \
community,<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-family:"Cambria",serif"><u></u> <u></u></span></p> <p \
class="MsoNormal"><span style="font-family:"Cambria",serif">I would like to \
implement a function that would log managed Exceptions into a dedicated \
table.<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-family:"Cambria",serif">For example, I have some code like \
:<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-family:"Cambria",serif">BEGIN<u></u><u></u></span></p> <p \
class="MsoNormal" style="margin-left:7.5pt"><span \
style="font-family:"Cambria",serif">Code generation \
exception<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-family:"Cambria",serif">EXCEPTION<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-family:"Cambria",serif"> WHEN OTHERS \
THEN <span style="background:yellow">Log_Error()</span>;<u></u><u></u></span></p>
<p class="MsoNormal"><span \
style="font-family:"Cambria",serif">END;<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-family:"Cambria",serif"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-family:"Cambria",serif">The Log_Error function would be able to \
get the exception context / parameters to log the exception parameters into a \
table.<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-family:"Cambria",serif">Is there any way to manage this without \
providing the Exception parameters as parameters to the Log_Error function \
?<u></u><u></u></span></p> <p class="MsoNormal"><span \
style="font-family:"Cambria",serif"><u></u> <u></u></span></p> <p \
class="MsoNormal"><span \
style="font-family:"Cambria",serif">Thanks,<u></u><u></u></span></p> <p \
class="MsoNormal"><span \
style="font-family:"Cambria",serif">Patrick<u></u><u></u></span></p> <p \
class="MsoNormal"><span style="font-family:"Cambria",serif"><u></u> \
<u></u></span></p> <p class="MsoNormal"><span \
style="font-family:"Cambria",serif"><u></u> <u></u></span></p> <p \
class="MsoNormal" style="text-align:justify"><b><span \
style="font-size:10.0pt;font-family:"Cambria",serif">Patrick \
Fiche<u></u><u></u></span></b></p> <p class="MsoNormal" \
style="text-align:justify"><span \
style="font-size:10.0pt;font-family:"Cambria",serif">Database Engineer, \
Aqsacom Sas.<u></u><u></u></span></p> <p class="MsoNormal" \
style="text-align:justify"><b><span \
style="font-size:10.0pt;font-family:"Cambria",serif">c.</span></b><span \
style="font-size:10.0pt;font-family:"Cambria",serif"> 33 6 82 80 69 96 \
<u></u><u></u></span></p> <p class="MsoNormal" style="text-align:justify"><b><span \
style="font-size:10.0pt;font-family:"Cambria",serif">e.</span></b><span \
style="font-size:10.0pt;font-family:"Cambria",serif"> <a \
href="mailto:patrick.fiche@aqsacom.com" target="_blank"><span \
style="color:#0563c1">patrick.fiche@aqsacom.com</span></a> <u></u><u></u></span></p>
<p class="MsoNormal" style="text-align:justify"><span \
style="font-size:10.0pt;font-family:"Cambria",serif"><u></u> \
<u></u></span></p> <p class="MsoNormal" style="text-align:justify"><a \
href="http://www.aqsacom.com/" target="_blank"><span \
style="font-size:10.0pt;font-family:"Cambria",serif;text-decoration:none"><img \
border="0" width="145" height="45" style="width:1.5104in;height:.4687in" \
id="m_-3929912706139619807Picture_x0020_2" src="cid:image001.png@01D46FB3.0EDED260" \
alt="01-03_AQSA_Main_Corporate_Logo_JPEG_White_Low.jpg"></span></a><span \
style="font-size:10.0pt;font-family:"Cambria",serif"><u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</blockquote></div>
--0000000000009a26fe057980a566--
["image001.png" (image/png)]
["image001.png" (image/png)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic