Hi Josh,

Josh Ward wrote:
> Problem discovered....
> 
> --- pf2010/bin/pfcmd_vlan     2010/07/07 21:26:56     1
> +++ pf2010/bin/pfcmd_vlan     2010/08/02 20:16:16     59
> @@ -215,12 +215,13 @@
>  } else {
>      $logLevel = $TRACE;
>  }
> -Log::Log4perl->easy_init(
> -    {   level  => $logLevel,
> -        layout => '%d (%r) %M%n    %m %n'
> -    }
> -);
> -my $logger = Log::Log4perl->get_logger('');
> +#Log::Log4perl->easy_init(
> +#    {   level  => $logLevel,
> +#        layout => '%d (%r) %M%n    %m %n'
> +#    }
> +#);
> +Log::Log4perl->init("/usr/local/pf/conf/log.conf");
> +my $logger = Log::Log4perl->get_logger('pfcmd_vlan');
> 
>  my $switchFactory = new pf::SwitchFactory(
>      -configFile => INSTALL_DIR . '/conf/switches.conf' );
> 
> 
> The easy_init doesn't seem to satisfy the needs to get everything
> logging to the correct place.
> 
> Should be cleaned up a little bit, but it's working now.

This is not broken but only slightly confusing.. well arguably not broken.

pfcmd_vlan since it is a command-line tool meant to be used 
interactively (or not) thus was not built with pf's standard log4perl 
configuration. Instead you control the log4perl logging with a flag and 
logs are output on the command-line (instead of logs/packetfence.log or 
controlled via conf/log.conf).

[r...@miller pf]# bin/pfcmd_vlan
Usage:
     pfcmd_vlan command [options]

[...]
        -verbose             log verbosity level
                               0 : fatal messages
                               1 : warn messages
                               2 : info messages
                               3 : debug
                               4 : trace


That said, pfcmd_vlan is called very often, if not always, internally so 
  I think we could change that behavior (integrating your fix) for the 
trunk branch.

Looking at the issue tracker, I realize the issue has already been 
filed: #874: pfcmd_vlan should log at the same place as everyone else
http://www.packetfence.org/bugs/view.php?id=874

I added comments and re-targeted to 1.10.0. My main concern is breaking 
current behavior (scripts that could rely on parsing verbose messages). 
Ideally, I would like to have log4perl output in both places (logfile 
according to log.conf and stdout according to the -verbose flag).

I hope it clarifies that the behavior was not 100% broken.

Thanks for your suggestion, it'll likely be integrated.
-- 
Olivier Bilodeau
obilod...@inverse.ca  ::  +1.514.447.4918 *115  ::  www.inverse.ca
Inverse inc. :: Leaders behind SOGo (www.sogo.nu) and PacketFence 
(www.packetfence.org)

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Packetfence-devel mailing list
Packetfence-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/packetfence-devel

Reply via email to