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   1776 Views

Avatar
frankmullenger

Forum Moderator, 51 Posts

21 May 2010 at 4:19pm

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

Forum Moderator, 5513 Posts

21 May 2010 at 8:26pm

Edited: 21/05/2010 8:27pm

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

Forum Moderator, 51 Posts

22 June 2010 at 5:28pm

Edited: 22/06/2010 7:13pm

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

Forum Moderator, 51 Posts

22 June 2010 at 6:07pm

Edited: 22/06/2010 7:05pm

Nothing to see here.