--- a/backend/server.js
+++ b/backend/server.js
@@ -9,12 +9,14 @@
var constants = require('../constants.js');
var methodOverride = require('method-override');
var mysql = require('mysql');
+var logger = require('../config/logger.js');
// Notification ===========================================
// config files
var db = require('../config/db');
+/*
//Environment Variables
console.log("Environment Variables:");
console.log("******************************************************");
@@ -25,12 +27,25 @@
console.log("Using DB Password: " + process.env.DBPASSWORD);
console.log("Using DB Database: " + process.env.DATABASE);
console.log("******************************************************");
+*/
+
+//Environment Variables
+logger.info("Environment Variables:");
+logger.info("******************************************************");
+logger.info("Using port: " + process.env.PORT);
+logger.info("Using User Email: " + process.env.USEREMAIL);
+logger.info("Using User Password: " + process.env.USERPWD);
+logger.info("Using DB User: " + process.env.DBUSER);
+logger.info("Using DB Password: " + process.env.DBPASSWORD);
+logger.info("Using DB Database: " + process.env.DATABASE);
+logger.info("******************************************************");
// set our port
var port = process.env.PORT || 8000;
// connect to our MySQL database
try {
+ logger.info("MySQL Trying to connect: ");
var con = mysql.createConnection({
host: db.host,
user: db.user,
@@ -42,7 +57,8 @@
if (err) throw err;
});
}catch(e){
- console.log("Database Problem: " + e.stack);
+ logger.error("MySQL error: ", e.stack);
+ //console.log("Database Problem: " + e.stack);
}
exports = module.exports = con;
@@ -71,7 +87,8 @@
// startup our app at http://localhost:3000
app.listen(port);
-console.log("Notification Enabler is running at port", port);
+logger.info("Notification Enabler is running at port", port);
+//console.log("Notification Enabler is running at port", port);
// expose app
exports = module.exports = app;