question: private OutputStream checkLogFile ( String basename , long maxRecords , boolean force ) throws IOException { final OutputStream newStream ; synchronized ( this ) { if ( ( force == false ) && ( logCount < maxRecords ) ) return logStream ; final OutputStream oldStream = logStream ; if ( oldStream != null ) { oldStream . flush ( ) ; oldStream . close ( ) ; } final File newFile = ( basename == null ) ? null : createNewLogFile ( basename ) ; newStream = ( newFile == null ) ? null : new FileOutputStream ( newFile , true ) ; logStream = newStream ; logFile = newFile ; fileCapacity = maxRecords ; logCount = 0 ; } sendNotification ( new Notification ( LOG_FILE_CHANGED , objectName , getNextSeqNumber ( ) , basename ) ) ; return newStream ; }
target:  Check whether a new log file should be created. If a new file needs to be created, creates it, renaming previously existing file by appending '~' to its name. Also reset the log count and file capacity. Sends a notification indicating that the log file was changed. Returns the new log stream; Creation of a new file can be forced by passing force=true.