Setting Up/Using Log System
Posted: Sat Mar 01, 2008 9:37 pm
I have setup the Swift Mailer scripts on our server and have tested them with the Smoke tests. Everything is working properly and I've put together a small test for myself using the below code:
The test works as expected however I'd like to setup/enable the logging system and then figure out how to use it. I've read the docs on the logging feature and have figure out that I need to add the following code somewhere:
The questions I have are:
1. I'm not sure where this code is supposed to go. Do I add it to the above code after the two require_once lines?
2. Is there anything else that needs to be done to enable the logging function, such as CHMOD a directory or specific file?
3. What file is the actual log file?
4. How do I setup a page to read from the log?
Code: Select all
require_once "/Library/WebServer/Documents/swift/lib/Swift.php";
require_once "/Library/WebServer/Documents/swift/lib/Swift/Connection/Sendmail.php";
//Try to connect using /usr/sbin/sendmail -bs
$swift =& new Swift(new Swift_Connection_Sendmail());
$message =& new Swift_Message("Some subject", "Your message <u>here</u>", "text/html");
if ($swift->send($message, "curseofthe8ball@yahoo.com", "curseofthe8ball@yahoo.com"))
{
echo "Message sent";
}
else
{
echo "Message failed to send";
}
$log =& Swift_LogContainer::getLog();
echo $log->dump(true);
//It's polite to do this when you're finished
$swift->disconnect();Code: Select all
$log =& Swift_LogContainer::getLog();
$log->setLogLevel(3);1. I'm not sure where this code is supposed to go. Do I add it to the above code after the two require_once lines?
2. Is there anything else that needs to be done to enable the logging function, such as CHMOD a directory or specific file?
3. What file is the actual log file?
4. How do I setup a page to read from the log?