Example #1
0
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../'));
$app->configureMonologUsing(function (\Monolog\Logger $monolog) use($app) {
    if (env('APP_USE_LOG_SERVER', false) === true) {
        $logServer = env('APP_LOG_SERVER', 'logs');
        $publisher = new \Gelf\Publisher(new \Gelf\Transport\UdpTransport($logServer));
        $handler = new \Monolog\Handler\GelfHandler($publisher);
        $handler->pushProcessor(new \Monolog\Processor\WebProcessor());
        $handler->pushProcessor(new \Monolog\Processor\UidProcessor());
        $monolog->pushHandler($handler);
    } else {
        $monolog->pushHandler($handler = new \Monolog\Handler\StreamHandler($app->storagePath() . '/logs/laravel.log'));
        $handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));
    }
});
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
Example #2
0
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'AbuseIO\\Http\\Kernel');
$app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'AbuseIO\\Console\\Kernel');
$app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'AbuseIO\\Exceptions\\Handler');
/**
 * Configure Monolog.
 */
$app->configureMonologUsing(function (Monolog\Logger $monolog) {
    $filename = storage_path('/logs/laravel-' . php_sapi_name() . '.log');
    $handler = new Monolog\Handler\RotatingFileHandler($filename);
    $monolog->pushHandler($handler);
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
Example #3
0
|
*/
$app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'DreamFactory\\Http\\Kernel');
$app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'DreamFactory\\Console\\Kernel');
$app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'DreamFactory\\Exceptions\\Handler');
$app->configureMonologUsing(function ($monolog) {
    $logFile = storage_path('logs/dreamfactory.log');
    if (config('df.managed')) {
        $logFile = Managed::getLogFile();
    }
    $mode = config('app.log');
    if ($mode === 'syslog') {
        $monolog->pushHandler(new SyslogHandler('dreamfactory'));
    } else {
        if ($mode === 'single') {
            $handler = new StreamHandler($logFile);
        } else {
            if ($mode === 'errorlog') {
                $handler = new ErrorLogHandler();
            } else {
                $handler = new RotatingFileHandler($logFile, 5);
            }
        }
        $monolog->pushHandler($handler);
        $handler->setFormatter(new LineFormatter(null, null, true, true));
    }
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'App\\Http\\Kernel');
$app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'App\\Console\\Kernel');
$app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'App\\Exceptions\\Handler');
$app->configureMonologUsing(function ($monolog) {
    $monolog->pushHandler(new StreamHandler(storage_path('logs/laravel_debug.log'), Logger::DEBUG, false));
    $monolog->pushHandler(new StreamHandler(storage_path('logs/laravel.log'), Logger::DEBUG, true));
    $monolog->pushHandler(new StreamHandler(storage_path('logs/laravel_info.log'), Logger::INFO, false));
    $monolog->pushHandler(new StreamHandler(storage_path('logs/laravel.log'), Logger::INFO, true));
    $monolog->pushHandler(new StreamHandler(storage_path('logs/laravel_w.log'), Logger::WARNING, false));
    $monolog->pushHandler(new StreamHandler(storage_path('logs/laravel.log'), Logger::WARNING, true));
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
Example #5
0
|
*/
$app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class);
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
// Configure Emailing of Log reports
$transport = \Swift_SmtpTransport::newInstance('smtpout.secureserver.net', 80, '')->setUsername('*****@*****.**')->setPassword('temppass');
$mailer = \Swift_Mailer::newInstance($transport);
$app->configureMonologUsing(function ($monolog) use($mailer) {
    $message = \Swift_Message::newInstance('Exception Occured at api.mispots.com')->setFrom(array('*****@*****.**' => 'Error reporting service'))->setTo(array('*****@*****.**' => 'Angelo m'));
    $message->setBody('', 'text/html');
    // $monolog->pushHandler(
    // 	new \Monolog\Handler\SwiftMailerHandler(
    // 		$mailer,
    // 		$message,
    // 		Logger::WARNING,
    // 		true
    // 	)
    // );
});
return $app;
Example #6
0
$app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'App\\Exceptions\\Handler');
/*
|--------------------------------------------------------------------------
| Custom Monolog Configuration
|--------------------------------------------------------------------------
|
| See: http://laravel.com/docs/5.1/errors
|      https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md
|      https://github.com/Seldaek/monolog/blob/master/doc/02-handlers-formatters-processors.md
|      http://laravel-tricks.com/tricks/monolog-for-custom-logging
|      https://laracasts.com/discuss/channels/general-discussion/advance-logging-with-laravel-and-monolog
*/
$app->configureMonologUsing(function ($monolog) {
    $handler = new Monolog\Handler\RotatingFileHandler(storage_path() . '/logs/laravel.log', 0, Monolog\Logger::DEBUG);
    //$handler->setFormatter(new Monolog\Formatter\LineFormatter(
    $handler->setFormatter(new App\LineNormalizer("[%datetime%] %extra.process_id% %channel%.%level_name% %extra.uName% %extra.class%::%extra.function%(%extra.line%): %message% %context%\n", null, true, true));
    $handler->pushProcessor(new Monolog\Processor\ProcessIdProcessor());
    $handler->pushProcessor(new Monolog\Processor\IntrospectionProcessor(Monolog\Logger::DEBUG, ["Illuminate\\Support\\Facades\\Log", "Illuminate\\Support\\Facades\\Facade", "Illuminate\\Log\\Writer"]));
    $monolog->pushHandler($handler);
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
Example #7
0
File: app.php Project: aorly/vAMSYS
*/
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
$app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../'));
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'vAMSYS\\Http\\Kernel');
$app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'vAMSYS\\Console\\Kernel');
$app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'vAMSYS\\Exceptions\\Handler');
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
$app->configureMonologUsing(function ($monolog) {
    $monolog->pushHandler(new StreamHandler('php://stderr', Logger::WARNING));
});
return $app;
Example #8
0
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'AbuseIO\\Http\\Kernel');
$app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'AbuseIO\\Console\\Kernel');
$app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'AbuseIO\\Exceptions\\Handler');
/*
 * Configure Monolog.
 */
$app->configureMonologUsing(function (Monolog\Logger $monolog) {
    $syslog = new \Monolog\Handler\SyslogHandler('abuseio');
    $formatter = new \Monolog\Formatter\LineFormatter('%channel%.%level_name%: %message%');
    $syslog->setFormatter($formatter);
    $monolog->pushHandler($syslog);
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
Example #9
0
$app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../'));
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(Illuminate\Contracts\Http\Kernel::class, CtrlV\Http\Kernel::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, CtrlV\Console\Kernel::class);
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, CtrlV\Exceptions\Handler::class);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
$app->configureMonologUsing(function ($monolog) use($app) {
    $path = $app->storagePath() . '/logs/laravel.log';
    $monolog->pushHandler($handler = new Monolog\Handler\RotatingFileHandler($path));
    $handler->setFormatter($formatter = new Monolog\Formatter\LineFormatter(null, null, true, true));
    $monolog->pushProcessor(new \Monolog\Processor\WebProcessor());
});
return $app;
Example #10
0
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'DreamFactory\\Http\\Kernel');
$app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'DreamFactory\\Console\\Kernel');
$app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'DreamFactory\\Exceptions\\Handler');
$app->configureMonologUsing(function (Logger $monolog) {
    $logFile = env('DF_MANAGED_LOG_PATH', storage_path('logs')) . DIRECTORY_SEPARATOR . env('DF_MANAGED_LOG_FILE', 'dreamfactory.log');
    $mode = config('app.log');
    if ($mode === 'syslog') {
        $monolog->pushHandler(new SyslogHandler('dreamfactory'));
    } else {
        if ($mode === 'single') {
            $handler = new StreamHandler($logFile);
        } else {
            if ($mode === 'errorlog') {
                $handler = new ErrorLogHandler();
            } else {
                $handler = new RotatingFileHandler($logFile, 5);
            }
        }
        $monolog->pushHandler($handler);
        $handler->setFormatter(new LineFormatter(null, null, true, true));
    }
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
Example #11
0
*/
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
$app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../'));
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->configureMonologUsing(function ($monolog) {
    $monolog->pushHandler(new StreamHandler(storage_path('logs/laravel_api.log'), Logger::NOTICE));
    $monolog->pushHandler(new StreamHandler(storage_path('logs/laravel_warning.log'), Logger::WARNING));
});
$app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class);
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
Example #12
0
|
*/
$app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'App\\Http\\Kernel');
$app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'App\\Console\\Kernel');
$app->singleton('Illuminate\\Contracts\\Debug\\ExceptionHandler', 'App\\Exceptions\\Handler');
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
/*
if (strstr($_SERVER['HTTP_USER_AGENT'], 'PhantomJS') && Utils::isNinjaDev()) {
    $app->loadEnvironmentFrom('.env.testing');
}
*/
// Write info messages to a separate file
$app->configureMonologUsing(function ($monolog) {
    $monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-info.log', Monolog\Logger::INFO, false));
    $monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-warning.log', Monolog\Logger::WARNING, false));
    $monolog->pushHandler(new Monolog\Handler\StreamHandler(storage_path() . '/logs/laravel-error.log', Monolog\Logger::ERROR, false));
});
// Capture real IP if using cloudflare
if (isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
    $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
return $app;
Example #13
0
<?php

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../'));
$app->configureMonologUsing(function (Monolog\Logger $monolog) {
    $filename = storage_path('logs/' . gethostname() . '.log');
    $handler = new Monolog\Handler\RotatingFileHandler($filename);
    $monolog->pushHandler($handler);
});
require 'env.php';
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton('Illuminate\\Contracts\\Http\\Kernel', 'App\\Http\\Kernel');
$app->singleton('Illuminate\\Contracts\\Console\\Kernel', 'App\\Console\\Kernel');
Example #14
0
*/
$app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../'));
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class);
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class);
$app->configureMonologUsing(function ($monolog) {
    $slackHandler = new Monolog\Handler\SlackHandler(env('SLACK_API_TOKEN'), '#devplayground');
    $slackHandler->setlevel(Monolog\Logger::INFO);
    $monolog->pushHandler($slackHandler);
});
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
Example #15
0
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class);
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
if (getenv('GRAYLOG')) {
    $app->configureMonologUsing(function ($monolog) {
        $transport = new \Gelf\Transport\UdpTransport(getenv('GRAYLOG_IP'), getenv('GRAYLOG_UDP_PORT'), \Gelf\Transport\UdpTransport::CHUNK_SIZE_LAN);
        $publisher = new \Gelf\Publisher();
        $publisher->addTransport($transport);
        $monolog->pushHandler(new \Monolog\Handler\GelfHandler($publisher));
    });
}
return $app;
Example #16
0
*/
$app = new Illuminate\Foundation\Application(realpath(__DIR__ . '/../'));
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class);
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class);
if (!empty(env('LOGENTRIES_TOKEN'))) {
    $app->configureMonologUsing(function ($monolog) {
        $monolog->pushHandler(new Monolog\Handler\LogEntriesHandler(env('LOGENTRIES_TOKEN')));
    });
}
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;