cornernote / yii-audit-module

Track and display usage information including page requests, database field changes, php errors and yii logs.
https://cornernote.github.io/yii-audit-module
Other
22 stars 13 forks source link

Also the log stores the query twice why is this happening #4

Open ryan876smith opened 10 years ago

cornernote commented 10 years ago

Is it the same format each time (eg, the same thing inserting twice, or is it 2 things that insert with different formatting)?

Can you share your log config from your config/main.php?

ryan876smith commented 10 years ago

<?php

$homePath = dirname(FILE) . '/../..'; $protectedPath = _joinpath($homePath, 'protected'); $webrootPath = _joinpath($homePath, 'webroot'); $runtimePath = _joinpath($homePath, 'runtime'); $dataPath = _joinpath($homePath, 'data');

$dbhost ="localhost"; $dbuser = $dbuser1 ="root"; $dbpass = $dbpass1 =""; $dbname ="smartfol_soda"; $dbname1 ="core";

// Yii::setPathOfAlias('bootstrap', $protectedPath .'/extensions/bootstrap');

// uncomment the following to define a path alias // Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable // CWebApplication properties can be configured here. return array(

'configConsole' => array( 'basePath' => dirname(FILE).DIRECTORY_SEPARATOR.'..', 'name' => 'My Console Application', // Aliases 'aliases' => 'inherit',

// Preloading 'log' component 'preload' => array('log'),

// Autoloading model and component classes 'import'=>array( 'application.helpers.', 'application.models.', 'application.components.', 'application.helper.', 'application.modules.cms.CmsModule', 'application.modules.auditTrail.models.AuditTrail', 'application.modules.user.models.', 'application.modules.user.components.', 'application.modules.rights.', 'application.modules.rights.components.', 'application.extensions.YiiMongoDbSuite.', 'application.extensions.EfineUploader.', 'application.extensions.x-editable.', 'application.extensions.uniqueMultiColumnValidator.', 'application.modules.edify.models.', 'application.modules.edify.components.', 'application.modules.quantify.models.', 'application.modules.admin.models.', 'application.modules.audit.models.', 'application.modules.audit.components.', 'bootstrap.helpers.TbHtml', ), 'modules'=>array( 'user'=>array( 'tableUsers' => 'users', 'tableProfiles' => 'users_profiles', 'tableProfileFields' => 'users_profiles_fields',

encrypting method (php hash function)

'hash' => 'sha256',

send activation email

'sendActivationMail' => true,

allow access for non-activated users

'loginNotActiv' => false,

activate user on registration (only sendActivationMail = false)

'activeAfterRegister' => false,

automatically login from registration

'autoLogin' => true,

registration path

'registrationUrl' => array('/user/registration'),

recovery password path

'recoveryUrl' => array('/user/recovery'),

login form path

'loginUrl' => array('/'),

page after login

'returnUrl' => array('/user/profile'),

page after logout

'returnLogoutUrl' => array('/'), ), ), // Application componentshome 'components'=>array( 'user'=>array( 'class'=>'application.extensions.console.ConsoleUser', ), // Database 'db'=>'inherit', // Application Log 'log' => array( 'class' => 'CLogRouter', 'routes' => array( // Save log messages on file array( 'class' => 'CFileLogRoute', 'levels' => 'error, warning, trace, info', ), ), ),

), 'params'=>array( // this is used in contact page 'ConsoleMode'=> true, 'webRoot'=> $webrootPath . DIRECTORY_SEPARATOR . 'sites' , 'latestBuild'=> $webrootPath. DIRECTORY_SEPARATOR . 'clone.zip', 'modeTemplate'=> $protectedPath. DIRECTORY_SEPARATOR . 'config'. DIRECTORY_SEPARATOR .'mode.template.php', 'configFolder'=> $protectedPath. DIRECTORY_SEPARATOR . 'config'. DIRECTORY_SEPARATOR , 'indexTemplate'=> 'index.tpl.php' ),

),

'configWeb' => array( 'basePath' => $protectedPath, 'runtimePath' => $runtimePath, 'defaultController' => 'site', // preloading 'log' component 'preload' => array( 'log', 'errorHandler', // handle fatal errors ), 'aliases' => array( //If you manually installed it 'xupload' => 'ext.xupload', 'bootstrap' => $protectedPath.'/extensions/bootstrap', // change this if necessary 'editable' => $protectedPath. '/extensions/x-editable' , // change this if necessary

'uniqueMultiColumnValidator'=>'application.extensions.uniqueMultiColumnValidator', 'EWordValidator'=>'application.extensions.EWordValidator', ), // autoloading model and component classes 'import'=>array( 'application.helpers.', 'application.models.', 'application.components.', 'application.helper.', 'application.modules.auditTrail.models.AuditTrail', 'application.modules.user.', 'application.modules.user.models.', 'application.modules.user.components.', 'application.modules.rights.', 'application.modules.rights.components.', 'application.extensions.YiiMongoDbSuite.', 'application.extensions.EfineUploader.', 'application.extensions.x-editable.', 'application.extensions.uniqueMultiColumnValidator.', 'application.extensions.EWordValidator.', 'application.modules.edify.models.', 'application.modules.edify.components.', 'application.modules.quantify.models.', 'application.modules.admin.models.', 'application.modules.audit.models.', 'application.modules.audit.components.', 'application.modules.cms.*', 'bootstrap.helpers.TbHtml', ), 'theme'=>'bootstrap', 'modules'=>array( 'rights'=>array( 'superuserName'=>'admin', // Name of the role with super user privileges. 'authenticatedName'=>'Authenticated', // Name of the authenticated user role. 'userIdColumn'=>'userid', // Name of the user id column in the database. 'userNameColumn'=>'username', // Name of the user name column in the database. 'enableBizRule'=>false, // Whether to enable authorization item business rules. 'enableBizRuleData'=>false, // Whether to enable data for business rules. 'displayDescription'=>true, // Whether to use item description instead of name. 'flashSuccessKey'=>'RightsSuccess', // Key to use for setting success flash messages. 'flashErrorKey'=>'RightsError', // Key to use for setting error flash messages. 'baseUrl'=>'/rights', // Base URL for Rights. Change if module is nested. 'layout'=>'application.views.layouts.column1', // Layout to use for displaying Rights. 'appLayout'=>'application.views.layouts.main', // Application layout. 'cssFile'=>'rights.css', // Style sheet file to use for Rights. // 'install'=>false, // Whether to enable installer. 'debug'=>true, // Whether to enable debug mode. ), ),

// application components 'components'=>array( 'bootstrap'=>array( 'class'=>'bootstrap.components.TbApi', ), 'editable' => array( 'class' => 'editable.EditableConfig', 'form' => 'bootstrap', //form style: 'bootstrap', 'jqueryui', 'plain' 'mode' => 'inline', //mode: 'popup' or 'inline' 'defaults' => array('emptytext' => 'Click to edit' ), //default settings for all editable elements

), 'user'=>array( 'class'=>'RWebUser', // enable cookie-based authentication 'allowAutoLogin'=>true, 'loginUrl'=>array('/site/login'), ), 'authManager'=>array( 'class'=>'RDbAuthManager', 'connectionID'=>'db', 'defaultRoles'=>array('Authenticated'), 'assignmentTable'=>'Rights_AuthAssignment', 'itemTable'=>'Rights_Authitem', 'itemChildTable'=>'Rights_AuthItemChild', ), 'request'=>array( 'enableCsrfValidation'=>true, 'enableCookieValidation'=>true, ), // uncomment the following to enable URLs in path-format 'urlManager'=>array( 'urlFormat'=>'path', 'rules'=>array( 'controller:w+/id:-?d+'=>'/view', 'controller:w+/action:w+/id:-?d+'=>'/', 'controller:w+/action:w+'=>'/', 'page/-id:d+.html'=>'cms/node/page', // clean URLs for pages

), 'showScriptName'=>false, ), / 'mongodb' => array( 'class' => 'EMongoDB', 'connectionString' => 'mongodb://localhost', 'dbName' => 'smartfol_soda', 'fsyncFlag' => false, 'safeFlag' => false, 'useCursor' => false, ), / 'core'=>array( 'class'=>'CDbConnection', 'connectionString' => 'mysql:host='.$dbhost.';dbname='.$dbname1, 'emulatePrepare' => true, 'username' => $dbuser1, 'password' => $dbpass1, 'charset' => 'utf8', 'enableProfiling' => true, 'enableParamLogging' => true, ), 'errorHandler'=>array( // use 'site/error' action to display errors 'errorAction'=>'site/error', ), 'cms'=>array( 'class'=>'cms.components.Cms' ),

),

), );

On Mon, Mar 17, 2014 at 5:54 PM, cornernote notifications@github.comwrote:

Is it the same format each time (eg, the same thing inserting twice, or is it 2 things that insert with different formatting)?

Can you share your log config from your config/main.php?

Reply to this email directly or view it on GitHubhttps://github.com/cornernote/yii-audit-module/issues/4#issuecomment-37875832 .

cornernote commented 10 years ago

The interesting part is:

'log' => array(
'class' => 'CLogRouter',
 'routes' => array(
// Save log messages on file
array(
 'class' => 'CFileLogRoute',
'levels' => 'error, warning, trace, info',
 ),
),
),

Seems you are not using AuditLogRoute, which means it shouldn't be storing anything in the log.

Perhaps I misunderstand the issue. Which table is storing the query twice?

ryan876smith commented 10 years ago

So we i examine the AuditLogRoute it has start: and end: before a query and it stored both I had the logroute in so that kinda weird but i echo out $log from AuditLogRoute i notice the start: and end: \ before the query and it saved the query twice is what i meant

On Tue, Mar 18, 2014 at 6:53 PM, cornernote notifications@github.comwrote:

The interesting part is:

'log' => array( 'class' => 'CLogRouter', 'routes' => array( // Save log messages on file array( 'class' => 'CFileLogRoute', 'levels' => 'error, warning, trace, info', ), ), ),

Seems you are not using AuditLogRoute, which means it shouldn't be storing anything in the log.

Perhaps I misunderstand the issue. Which table is storing the query twice?

Reply to this email directly or view it on GitHubhttps://github.com/cornernote/yii-audit-module/issues/4#issuecomment-37999024 .

cornernote commented 10 years ago

Sorry, i'm not sure what you mean. Can you send a screenshot?