| Author |
Message |
|
| maxlapshin |
Posted: Wed Jun 02, 2010 10:15 am |
|
|
|
User
Joined: 15 Sep 2009
Posts: 159
|
Hi. I want to use log4erl as a default error logger for all system (to
log all process failures),
but I don't understand how.
What part of erlang documentation have I missed? Where should I read
to understand, how to change logger.
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Gleber |
Posted: Wed Jun 02, 2010 10:53 am |
|
|
|
User
Joined: 15 May 2007
Posts: 75
|
Hi Max
I've been peeking into this because of curiosity too some time ago,
but never get to any working code. Here's a logger module does which
more-or-less the same thing you want to do:
http://jungerl.cvs.sourceforge.net/viewvc/jungerl/jungerl/lib/msc/src/logger.erl?revision=1.2&view=markup
Best,
Gleb Peregud
On Wed, Jun 2, 2010 at 12:13, Max Lapshin <max.lapshin@gmail.com> wrote:
> Hi. I want to use log4erl as a default error logger for all system (to
> log all process failures),
> but I don't understand how.
>
> What part of erlang documentation have I missed? Where should I read
> to understand, how to change logger.
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>
>
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| qoocku |
Posted: Wed Jun 02, 2010 12:17 pm |
|
|
|
User
Joined: 31 Mar 2008
Posts: 10
Location: Poland
|
W dniu 02.06.2010 12:13, Max Lapshin pisze:
> Hi. I want to use log4erl as a default error logger for all system (to
> log all process failures),
> but I don't understand how.
>
> What part of erlang documentation have I missed? Where should I read
> to understand, how to change logger.
>
error_logger is "gen_event" process registered locally under the name
"error_logger". The process start is hard-coded in the "kernel"
application (kernel.erl module implements "kernel_sup" supervisor
behavior - this supervisor launches the "error_logger" process) which is
loaded as the very first. What you can do is to kill this process as
soon as possible (risking that some logging messages would not reach the
logger) and replace it with another "gen_event" process registering it
under the name "error_logger". You may obtain this by launching special
application that starts only the specialized gen_event process (if you
want to use it in a boot script) or by passing a command line options
"-s <module_name>" which fires <module_name>:start/0 function. The
latter is launched after all primary application has been loaded, so the
initial logs would go through the standard error_logger. I think you
should write a special "launcher" module to replace the standard logger.
Besides log4erl must implements error_logger message protocol. I do not
know it is so.
Hope this helps,
Damian
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>
Post received from mailinglist |
|
|
| Back to top |
|
| alexarnon |
Posted: Wed Jun 02, 2010 12:23 pm |
|
|
|
User
Joined: 26 Jan 2008
Posts: 14
|
Could one possibly simply add an error_logger appender?
Maybe make it the default?
2010/6/2 Damian DobroczyĆski <qoocku@gmail.com>
> W dniu 02.06.2010 12:13, Max Lapshin pisze:
> > Hi. I want to use log4erl as a default error logger for all system (to
> > log all process failures),
> > but I don't understand how.
> >
> > What part of erlang documentation have I missed? Where should I read
> > to understand, how to change logger.
> >
>
> error_logger is "gen_event" process registered locally under the name
> "error_logger". The process start is hard-coded in the "kernel"
> application (kernel.erl module implements "kernel_sup" supervisor
> behavior - this supervisor launches the "error_logger" process) which is
> loaded as the very first. What you can do is to kill this process as
> soon as possible (risking that some logging messages would not reach the
> logger) and replace it with another "gen_event" process registering it
> under the name "error_logger". You may obtain this by launching special
> application that starts only the specialized gen_event process (if you
> want to use it in a boot script) or by passing a command line options
> "-s <module_name>" which fires <module_name>:start/0 function. The
> latter is launched after all primary application has been loaded, so the
> initial logs would go through the standard error_logger. I think you
> should write a special "launcher" module to replace the standard logger.
> Besides log4erl must implements error_logger message protocol. I do not
> know it is so.
>
> Hope this helps,
> Damian
>
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > See http://www.erlang.org/faq.html
> > To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
> >
>
>
>
Post received from mailinglist |
|
|
| Back to top |
|
| qoocku |
Posted: Wed Jun 02, 2010 12:31 pm |
|
|
|
User
Joined: 31 Mar 2008
Posts: 10
Location: Poland
|
W dniu 02.06.2010 12:13, Max Lapshin pisze:
> Hi. I want to use log4erl as a default error logger for all system (to
> log all process failures),
> but I don't understand how.
>
> What part of erlang documentation have I missed? Where should I read
> to understand, how to change logger.
>
I've looked at the log4erl code and there is a module called
"error_logger_log4erl_h" which implements gen_event behavior and acts as
a "bridge" between error_logger protocol and log4erl protocol.
Apparently, you have to add this handler to the standard event_logger
process so that all other processes using error_logger calls may be
logged by log4erl logger. I think you cannot replace standard
error_logger because log4erl do not implement error_logger protocol.
Both must co-exists within the system.
D.
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>
Post received from mailinglist |
|
|
| Back to top |
|
| qoocku |
Posted: Wed Jun 02, 2010 12:34 pm |
|
|
|
User
Joined: 31 Mar 2008
Posts: 10
Location: Poland
|
W dniu 02.06.2010 14:22, Alex Arnon pisze:
> Could one possibly simply add an error_logger appender?
> Maybe make it the default?
Sorry, I do not know log4erl application ; but what I've seen in the
source code there's nothing like error_logger appender (unless you
create it) but only error_logger events handler which acts like a
"bridge" between error_logger protocol and log4erl protocol (as I've
written in the previous post).
B.r.
D.
>
>
> 2010/6/2 Damian DobroczyĆski <qoocku@gmail.com>
>
>> W dniu 02.06.2010 12:13, Max Lapshin pisze:
>>> Hi. I want to use log4erl as a default error logger for all system (to
>>> log all process failures),
>>> but I don't understand how.
>>>
>>> What part of erlang documentation have I missed? Where should I read
>>> to understand, how to change logger.
>>>
>>
>> error_logger is "gen_event" process registered locally under the name
>> "error_logger". The process start is hard-coded in the "kernel"
>> application (kernel.erl module implements "kernel_sup" supervisor
>> behavior - this supervisor launches the "error_logger" process) which is
>> loaded as the very first. What you can do is to kill this process as
>> soon as possible (risking that some logging messages would not reach the
>> logger) and replace it with another "gen_event" process registering it
>> under the name "error_logger". You may obtain this by launching special
>> application that starts only the specialized gen_event process (if you
>> want to use it in a boot script) or by passing a command line options
>> "-s <module_name>" which fires <module_name>:start/0 function. The
>> latter is launched after all primary application has been loaded, so the
>> initial logs would go through the standard error_logger. I think you
>> should write a special "launcher" module to replace the standard logger.
>> Besides log4erl must implements error_logger message protocol. I do not
>> know it is so.
>>
>> Hope this helps,
>> Damian
>>
>>> ________________________________________________________________
>>> erlang-questions (at) erlang.org mailing list.
>>> See http://www.erlang.org/faq.html
>>> To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
>>>
>>
>>
>>
>
Post received from mailinglist |
|
|
| Back to top |
|
| siv |
Posted: Wed Jun 02, 2010 12:39 pm |
|
|
|
User
Joined: 06 May 2010
Posts: 19
|
|
| Back to top |
|
| Guest |
Posted: Wed Jun 02, 2010 12:52 pm |
|
|
|
Guest
|
Default error_logger implements gen_event behavior that allows swapping
handlers. You can take a look at how LAMA application does it in the
start_link() function by changing default logger to format and send log
events to a syslog daemon:
http://jungerl.cvs.sourceforge.net/viewvc/jungerl/jungerl/lib/lama/src/lama_syslog_h.erl?revision=1.4&view=markup
Serge
On 6/2/2010 8:37 AM, Alessandro Sivieri wrote:
> For what I have seen, too, there is no way to replace the default logger
> with a different one (as in Java, for example); maybe we can suggest this
> modification to the OTP maintainers, or they can tell us if there is some
> reason in not allowing this.
>
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| sbalea |
Posted: Wed Jun 02, 2010 3:36 pm |
|
|
|
User
Joined: 03 Jul 2007
Posts: 17
|
On Jun 2, 2010, at 8:37 AM, Alessandro Sivieri wrote:
> For what I have seen, too, there is no way to replace the default logger
> with a different one (as in Java, for example); maybe we can suggest this
> modification to the OTP maintainers, or they can tell us if there is some
> reason in not allowing this.
I don't see why you couldn't just replace the error_logger module with a custom one. You'd just need to be sure it has the same API. Otherwise stuff will break in nasty ways, since the error_logger module is used by all sorts of system code.
As others have mentioned, another (better) alternative would be to replace the default handlers with custom ones. After all, error_logger is just a gen_event process, so this is quite easy to do and can change the logging behavior completely. You'd have to handle the default OTP protocol, but that's not such a big deal.
Mihai
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| siv |
Posted: Wed Jun 02, 2010 3:48 pm |
|
|
|
User
Joined: 06 May 2010
Posts: 19
|
|
| Back to top |
|
| Ahmed |
Posted: Fri Jun 04, 2010 1:39 pm |
|
|
|
Joined: 03 Mar 2008
Posts: 8
|
Hi All,
It's funny that I've just responded to a query of a user few days ago
about the exact subject. Please find my copy-and-pasted response
below.
You can forward all error_logger requests to log4erl. You can do that using:
<code>
error_logger:delete_report_handler(error_logger), %% to disable
error_logger file output
error_logger:tty(false), %% to disable console output
log4erl:error_logger_handler(). %% to get all error_logger
</code>
You can check that log4erl is handling error_logger logs using:
> gen_event:which_handlers(error_logger).
I hope this answers your question. If not, please let me know.
Best regards,
Ahmed
On Wed, Jun 2, 2010 at 7:46 PM, Alessandro Sivieri
<alessandro.sivieri@gmail.com> wrote:
> Well, then it was not so clear how to do it...
>
> --
> Sivieri Alessandro
> alessandro.sivieri@gmail.com
> http://www.chimera-bellerofonte.eu/
> http://www.poul.org/
>
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| steved |
Posted: Sat Jun 05, 2010 12:20 am |
|
|
|
User
Joined: 29 Apr 2008
Posts: 78
|
Similar but different --- this was my solution to the logging issue
(though not log4erl based). It replaces the default error_logger but
allows it to swap back on termination. I also needed multiple log
files/log levels and a "default" log. The key parts are in the
start_link and handle_info for 'EXIT'.
http://github.com/komone/ewok/blob/master/src/ewok_logging_srv.erl
There could be some inspiration buried in it for the issue at hand.
regs,
/s
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questions-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| wuji |
Posted: Mon Sep 10, 2012 8:27 am |
|
|
|
User
Joined: 10 Aug 2012
Posts: 654
|
a third-rate reality show is now charged with first degree murder.Baron "Dirty" "Dirty" jordan 11 "Dirty" Colon, a 24-year-old barber and finalist in the 2009 MTV program
G's to Gents," was arrested on Jan. 7 in connection with the the cheap jordan shoes the fatal armed robbery of a Florida artist in 2006.Colon appeared on
second season of the show, produced by actor Jamie Foxx, in which which [h4]jordan 11[/h4] which young men with checkered pasts -- so-called "g's" or "gangstas" --
to turn their lives around and become "gentlemen.""I got two kids. I I cheap designer *beep* I want to be in the gentleman's club because I want to
for them," Colon said in the season's first episode. "If I don't don't jordan 11 don't change, there's only going to be two things: prison or death."Prison |
|
|
| Back to top |
|
|
|