Jump to:

23471 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Some answers please

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1733 Views
  • frankmullenger
    Avatar
    Forum Moderator
    51 Posts

    Some answers please Link to this post

    Hi,

    How can I disable the javascript validation of forms automagically inserted by swilverstripe? Reason being, I would like to control the javascripts included on each page on the site and include only the libraries I want basically.

    How can I log data while I'm developing and testing? I don't necessarily want to display the data on screen, just log data basically. I'd love the ability to log entire objects and run tail -f error.log to see variable values etc. while I'm developing without messing up the display of the site.

    Thanks

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Some answers please Link to this post

    Hi Frank, Welcome to the forums

    You can disable js validation by setting this in your _config.php file.

    Validator::set_javascript_validation_handler('none');

    Logging data depends what version of SS your using. In 2.4 debug logging has a totally new setup you can use. Use the SS_Log class to write to a file. So first you define your writer in your config file.

    SS_Log::add_writer(new SS_LogFileWriter('errors.log'));

    Then you can write to the log.

    SS_Log::log("This is something to log");

    What you pass to that could be something like Debug::show($object) or a print_r($object) which will output the object or you can do specific values.

  • frankmullenger
    Avatar
    Forum Moderator
    51 Posts

    Re: Some answers please Link to this post

    Example of logging a basic message, need to pass Exception or an Array with following possible keys

    //Logging
    SS_Log::add_writer(new SS_LogFileWriter('/var/www/silverstripe/mysite/errors.log'));
    SS_Log::log(new Exception('Some log message here'), SS_Log::NOTICE);

    $message = array(
    'errno' => '',
    'errstr' => 'Testing',
    'errfile' => '',
    'errline' => '',
    'errcontext' => ''
    );
    SS_Log::log($message, SS_Log::NOTICE);

  • frankmullenger
    Avatar
    Forum Moderator
    51 Posts

    Re: Some answers please Link to this post

    Nothing to see here.

    1733 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.