SSbits - Home page
Site by Carbon Crayon
Submit a Post >

Snippets - Little bits of code to make you happy

Get errors e-mailed to you

If your site is live it means you are probably not getting errors reported in the view, so it's handy to have them emailed to you so you can still debug and also be notified if something is up.

Add this line to your mysite/_config.php file and expect some mail!

SS_Log::add_writer(new SS_LogEmailWriter(''), SS_Log::ERR);


This method can also be used to log errors to a file:

SS_Log::add_writer(new SS_LogFileWriter('error_log.txt'), SS_Log::ERR);

Note, in 2.3.x you will need to use a different method:

Aram Balakjian avatar

Aram Balakjian

Aram is a web developer running London based agency Aab Web. He has a strong passion for developing attractive, usable sites around the SilverStripe CMS.

No one has commented on this page yet.

Post a comment ...

You cannot post comments until you have logged in. Login Here.


Site of the Month

Find SSbits on

Top Contributers

Rank Avatar Name
1 article image Aram Balakjian
2 article image wfacewomens
3 article image Daniel Hensby
4 article image Marcus Dalgren
5 article image ryduhartchas
6 article image Hamish Campbell
7 article image Ty Barho
8 article image Martijn van Nieuwenhoven
9 article image Darren-Lee
10 article image Roman Schmid

View full leaderboard