[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack Trace



Thanks! I dont mind having a complex Sysconfig.pm I have loads of custom
stuff in there.

I was looking at the log4perl setup in Sysconfig.pm and cant figure out
what its is supposed to do?
Where is the log file located?
I see this in the 1.4 configuration:

# Log4perl configuration
our $log4perl_config = qq(
    log4perl.rootlogger = $log_level, Basic, Debug
    )
    .
    $modules_loglevel_overrides
    .
    qq(
    log4perl.appender.Screen = Log::Log4perl::Appender::Screen
    log4perl.appender.Screen.layout = SimpleLayout
    # Filter for debug level
    log4perl.filter.MatchDebug = Log::Log4perl::Filter::LevelMatch
    log4perl.filter.MatchDebug.LevelToMatch = INFO
    log4perl.filter.MatchDebug.AcceptOnMatch = false

    # Filter for everything but debug,trace level
    log4perl.filter.MatchRest = Log::Log4perl::Filter::LevelMatch
    log4perl.filter.MatchRest.LevelToMatch = INFO
    log4perl.filter.MatchRest.AcceptOnMatch = true

    # layout for DEBUG,TRACE messages
    log4perl.appender.Debug = Log::Log4perl::Appender::Screen
    log4perl.appender.Debug.layout = PatternLayout
    log4perl.appender.Debug.layout.ConversionPattern = %d - %p - %l -- %m%n
    log4perl.appender.Debug.Filter = MatchDebug

    # layout for non-DEBUG messages
    log4perl.appender.Basic = Log::Log4perl::Appender::Screen
    log4perl.appender.Basic.layout = PatternLayout
    log4perl.appender.Basic.layout.ConversionPattern = %d - %p - %M -- %m%n
    log4perl.appender.Basic.Filter = MatchRest
);

I am reading up on this:
http://search.cpan.org/~mschilli/Log-Log4perl-1.44/lib/Log/Log4perl.pm

And where would this commented out part go?
#some examples of loglevel setting for modules
#FATAL, ERROR, WARN, INFO, DEBUG, TRACE
#log4perl.logger.LedgerSMB = DEBUG
#log4perl.logger.LedgerSMB.DBObject = INFO
#log4perl.logger.LedgerSMB.DBObject.Employee = FATAL
#log4perl.logger.LedgerSMB.Handler = ERROR
#log4perl.logger.LedgerSMB.User = WARN
#log4perl.logger.LedgerSMB.ScriptLib.Company=TRACE
#print STDERR localtime()." Sysconfig log4perl_config=$log4perl_config\n";

Cheers
Turtle

> sorry for the blank reply.  Trying again:
>
>
> On Mon, May 19, 2014 at 8:50 PM, Chris Travers
> <..hidden..>wrote:
>
>>
>>
>>
>> On Mon, May 19, 2014 at 2:19 PM, <..hidden..> wrote:
>>
>>> Dear Ledgersmb developers in order for me to debug applications I use a
>>> what I call a 'stack trace'. To do this in Ledgersmb I have some code
>>> in
>>> the beginning of every subroutine  like so:
>>>
>>> if ( ${LedgerSMB::Sysconfig::debug} ) {
>>>         open FILE, '>>', "../debug.txt";
>>>         my $debug_sub  = ( caller(0) )[3],;
>>>         my $debug_file = __FILE__,;
>>>         $debug_sub =~ s/.*:://g;
>>>         print FILE __FILE__, " sub $debug_sub Line: ", __LINE__, "\n";
>>>         print FILE "Caller: ", caller, "\n\n";
>>>         close FILE;
>>>     }
>>>
>>
>
> Options, options, options....
>
> If you need to do this, you can write Carp::longmess() instead.
>
> However, better IMO is to use Carp::Always and warn().  That way when
> Carp::Always is loaded you get a full stack trace, and when it is not, you
> don't.
>
> Another option you can do is alter your log4perl configuration to log to a
> custom file, and add a %T to the layout pattern.  This would require very
> light patching to Sysconfig.pm (
> log4perl.appender.Debug.layout.ConversionPattern = %d - %p - %l -- %m%n
> could get changed to
> log4perl.appender.Debug.layout.ConversionPattern = %d - %p - %l -- %m%n %T
> %n
> )
>
> Maybe we should make the default configuration read from a log4perl
> configuration file to make it easier to change?
>
>>
>>> In Form.pm, User.pm or other frequently hit files I will add varying
>>> levels if ( ${LedgerSMB::Sysconfig::debug} > 2 )
>>>
>>> I end up with a file that steps through the program like so:
>>> arap.pl 1310 continue
>>> mainmenu.pl191
>>>
>>> pe.pl  1138 sub project_report
>>> mainbin/arap.pl1314
>>> LedgerSMB/PE.pm sub projects Line: 45
>>> Caller: mainbin/pe.pl1146
>>>
>>> Is there any easier way to achieve this in 1.4?
>>> Cheers
>>> Turtle
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>>> Instantly run your Selenium tests across 300+ browser/OS combos.
>>> Get unparalleled scalability from the best Selenium testing platform
>>> available
>>> Simple to use. Nothing to install. Get started now for free."
>>> http://p.sf.net/sfu/SauceLabs
>>> _______________________________________________
>>> Ledger-smb-devel mailing list
>>> ..hidden..
>>> https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel
>>>
>>
>>
>>
>> --
>> Best Wishes,
>> Chris Travers
>>
>> Efficito:  Hosted Accounting and ERP.  Robust and Flexible.  No vendor
>> lock-in.
>> http://www.efficito.com/learn_more
>>
>
>
>



------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel