Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

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

Some answers please


Reply

4 Posts   1759 Views

Avatar
frankmullenger

21 May 2010 at 4:19pm Forum Moderator, 51 Posts

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

Avatar
Willr

21 May 2010 at 8:26pm (Last edited: 21 May 2010 8:27pm), Forum Moderator, 5511 Posts

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.

Avatar
frankmullenger

22 June 2010 at 5:28pm (Last edited: 22 June 2010 7:13pm), Forum Moderator, 51 Posts

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);

Avatar
frankmullenger

22 June 2010 at 6:07pm (Last edited: 22 June 2010 7:05pm), Forum Moderator, 51 Posts

Nothing to see here.