HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

A few questions about basic logger

I thought I would take this plugin through a trial run. but....
It's not entirely intuitive from the instructions and a couple of questions.

1) Do I have to configure anything at all to make it work out of the box?
2)does the xml have to be configured or only if I want to change it?

it says it will create a database of log messages if I read it correctly.

3) is this how one would use it

would I put these lines in a function anywhere in the core code or would i put in a plugin in an event function.

$Logger = LoggerPlugin::GetLogger();

// Log several messages, one for each available level
$Logger->trace("here is my $variable");

I didn't see any table created in my vanilla database, am I doing anything wrong.

5) in the code there seems to be code for adding logger to sidemenu in dashboard - it doesn't appear. After checking manage in the permissions.

with out spending a whole lot of time trying to figure this out - @businessdad anyone know the answers to above.

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Comments

  • businessdadbusinessdad Stealth contributor MVP
    edited November 2012

    Thanks for your feedback. I'm aware that the basic plugins is not 100% intuitive, in fact 90% of the time spent creating the advanced one was for the User Interface. It requires at least a basic knowledge of Log4php to be able to tweak it.

    To answer your questions.

    1. It works out of the box. In its default configuration, it saves log messages to table LoggerSysLog.
    2. XML can, but doesn't need to be modified for it to work.
    3. Your example is correct. The reason why you don't see any log message is that, by default, the log level is set to INFO, while you are using TRACE, which is lower. In this case, anything lower than INFO (i.e. DEBUG and TRACE) is ignored, the table doesn't even get created (it's created on the fly when the fist log message is added). To log TRACE messages, simply add <level value="TRACE" /> in config.xml file, in the <root> node.
    4. You didn't write a point 4. ;)
    5. It should add a Logger entry in the menu, in the Addons section. I will have a look at it. However, that link simply displays a page stating that you should modify the config.xml if you want to change the configuration.

    Update
    I checked the installation of the plugin, it indeed adds the Logger menu entry in the Addons section. What version of Vanilla are you using?

  • businessdadbusinessdad Stealth contributor MVP
    via Email
    I will update the documentation to make it clearer how the basic plugin
    works. Community feedback is invaluable, thanks for providing it. :)
  • businessdadbusinessdad Stealth contributor MVP

    Done! Documentation is now up to date, file readme.html explains what I wrote in reply to peregrine.

  • thx. @businessdad. will get back you you on the sidemenu thing and report back later.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited November 2012

    @businessdad

    see - http://vanillaforums.org/discussion/comment/170196/#Comment_170196
    since you are updating - might as well change these....

    'Version' => '12.11.22',
    public function Base_Render_Before(&$Sender) {
    public function PluginController_Logger_Create(&$Sender) {
    public function Controller_Settings(&$Sender) {
    public function Base_GetAppSettingsMenuItems_Handler(&$Sender) {
    
    probably better this way....
    
    public function Base_Render_Before($Sender) {
    public function PluginController_Logger_Create($Sender) {
    public function Controller_Settings($Sender) {
    public function Base_GetAppSettingsMenuItems_Handler($Sender) {
    

    probably this too

    $Menu = &$Sender->EventArguments['SideMenu'];

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited November 2012

    @businessdad

    Interesting plugin thanks. got it working.

    also in readme html. typo "fatail", if cut and pasted will generate fatal error :)

    $Logger->fatail('This is an FATAL message');

    should be

    $Logger->fatal('This is an FATAL message');

    P.S. sidemenu issue I mentioned is not a problem. I misinterpreted the line.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • businessdadbusinessdad Stealth contributor MVP
    edited November 2012

    @peregrine Thanks, I didn't notice it. In fact, in the plugin description the command is correct. I'll take note of it and fix it with next release. I use a Continuous Integration server for building, testing and packaging my plugins, but it's not wise to release a new package so late in the evening. :)

    Change of plan
    The &$Sender issue is more serious, it's worth fixing it immediately. New plugin coming. :)

  • businessdadbusinessdad Stealth contributor MVP

    Done! Plugin updated. Thanks again for the feedback. :)

  • @businessdad said:
    Done! Plugin updated. Thanks again for the feedback. :)

    pleasure.

    I use a Continuous Integration server for building, testing and packaging my plugins, but it's not wise to release a new package so late in the evening. :)

    someday, i'll drop you a line - I'd like to hear more about your unit testing, type of debugger (eclipse, netbeans, etc) and other cool stuff.

    So far I've used netbeans as a debugger - but it always crashes looking at watch variables. I tried eclipse without much success.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • businessdadbusinessdad Stealth contributor MVP

    I can answer you about the debugger: none. I simply use logging as wisely as I can (that's why I create a logger for Vanilla, a framework without a logger is like something without something) and the good old var_dump.

    In my career I worked with dozens of programming languages, most of which had their own IDE, and step-by-step debugging was a must. With PHP, I just find it simpler to debug "manually". So far, it's working. :)

  • I just tested logger plugin in v 2.1 - works fine.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • businessdadbusinessdad Stealth contributor MVP

    Thanks for the confirmation :)

Sign In or Register to comment.