developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 13 years ago

Closed 13 years ago

#357 closed enhancement (fixed)

jException - log de l'adresse ip

Reported by: sylvain261 Owned by: laurentj
Priority: normal Milestone: Jelix 1.0 RC1
Component: jelix:core Version: 1.0 beta 3.1
Severity: minor Keywords:
Cc: Blocked By:
Blocking: Documentation needed:
Hosting Provider: Php version:

Description

Ca serait tout aussi bien d'avoir l'adresse ip de l'internaute quand on logue une exception ou une erreur (comme c'est le cas avec jLog)

On pourrait : mettre à jour messageLogFormat dans defaultConfig.php

messageLogFormat = "%date%\t%ip%\t[%code%]\t%msg%\t%file%\t%line%\n"

Mettre à jour la construction de messageLog dans jException.lib.php

      if(!isset($_SERVER['REMOTE_ADDR'])){ // for CLI mode (bug #111)
          $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
      }

    // formatage du message de log
    $messageLog = strtr($conf['messageLogFormat'], array(
        '%date%' => date("Y-m-d H:i:s"),
        '%ip%'   => $_SERVER['REMOTE_ADDR'],
        '%code%' => $exception->getCode(),
        '%msg%'  => $msg,
        '%file%' => $exception->getFile(),
        '%line%' => $exception->getLine(),
        '%typeerror%'=>'exception',
        '\t' =>"\t",
        '\n' => "\n"
    ));

et mettre à jour jErrorHandler.lib.php

	  if(!isset($_SERVER['REMOTE_ADDR'])){ // for CLI mode (bug #111)
		  $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
	  }

    // formatage du message
    $messageLog = strtr($conf['messageLogFormat'], array(
        '%date%' => date("Y-m-d H:i:s"),
        '%ip%'   => $_SERVER['REMOTE_ADDR'],
        '%typeerror%'=>$codeString[$errno],
        '%code%' => $code,
        '%msg%'  => $errmsg,
        '%file%' => $filename,
        '%line%' => $linenum,
        '\t' =>"\t",
        '\n' => "\n"
    ));

Change History (2)

comment:1 Changed 13 years ago by laurentj

  • Milestone set to Jelix 1.0 RC1

comment:2 Changed 13 years ago by laurentj

  • Resolution set to fixed
  • Status changed from new to closed

Modification appliqué dans le trunk. Merci !

Note: See TracTickets for help on using tickets.