Log4php: write exceptions to db and file

1. Change log4php config file from xml to php format
2. Load log4php configuration from php file
3. Improve DebMes:
a) write logs to database
b) write error with different log level (warn, debug, fatall, etc.)

Mysql table for logging:
CREATE TABLE log4php_log (
    timestamp DATETIME,
    logger VARCHAR(256),
    level VARCHAR(32),
    message VARCHAR(4000),
    thread INTEGER,
    file VARCHAR(255),
    line VARCHAR(10)
);