Unifying Logging And Rotation

This wiki page contains an overview of currently existing logging and rotation mechanisms in HTCondor.

What is there?

- dprintf
- user logs
- event logs
- history files
- quill logs

Current API of the individual logging methods


User Log:
Writer- and Reader-class : WriteUserLog and ReadUserLog

- WriteUserLog

	May be global, may write out as XML

	- Instantiation:
    	WriteUserLog(const char *owner, const char *domain, const char *file,
				 int clu, int proc, int subp, bool xml = XML_USERLOG_DEFAULT,
				 const char *gjid = NULL);

    	WriteUserLog(const char *owner, const char *file,
				 int clu, int proc, int subp, bool xml = XML_USERLOG_DEFAULT);

		Also empty constructor possible, but that means that initialization has to be done separately.

	- Usage:
		  bool writeEvent (ULogEvent *event, ClassAd *jobad = NULL,
					 bool *written = NULL );

		Problem: This function returns success, even if no initialization was made (and therefore nothing was written)

	- Locking:
		- in write process:
				FileLockBase: lock on file is obtained
				lock is released upon completion

		private function for writing/locking: doWriteEvent(...)

	- Rotation:
		int doRotation( const char *path, FILE *&fp,
					MyString &rotated, int max_rotations );

		log files are named <name>.x, where <name>.1 is the most recently created file (apart from simply <name>, which is the current log file)
		A rename has to take place for all existing archived log files for every rotation.


Event Log:
UserLog API, different semantics


dprintf:
- initially used by daemon core with several different declarations
-- void dprintf( int flags, char* fmt, ... ) CHECK_PRINTF_FORMAT(3,4)
-- void dprintf( int, const char*, ... )
-- void	dprintf( int, char* ... )
-- void dprintf( int level ) const
-- void dprintf(unsigned int lvl)
-- void dprintf ( int flags, const char* fmt, ... ) CHECK_PRINTF_FORMAT(2,3)
-- void dprintf ()


Quill:
uses daemon core dprintf

Current semantics

TODO

Some commonly used logging/rotation tools

syslog : typically system administrator determines log destination, not software
Log4J : Apache logging tool for Java
Log4CPP : Logging tool for C++ modeled after Log4J
Log4C : --- " ---- for C