DateFormat df = new SimpleDateFormat( ConnectionCoreConstants.DATEFORMAT );
String errorComment = "#!ERROR " + exception.getMessage(); //$NON-NLS-1$
errorComment = errorComment.replaceAll( "\r", " " ); //$NON-NLS-1$ //$NON-NLS-2$
errorComment = errorComment.replaceAll( "\n", " " ); //$NON-NLS-1$ //$NON-NLS-2$
LdifCommentLine errorCommentLine = LdifCommentLine.create( errorComment );
logWriter.write( LdifCommentLine.create( "#!RESULT ERROR" )
.toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NL LdifFormatParameters.DEFAULTS-1$
logWriter
.write( LdifCommentLine
.create(
"#!CONNECTION ldap://" + browserConnection.getConnection().getHost() + ":" + browserConnection.getConnection().getPort() ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$ //$NON-NLS-2$
logWriter.write( LdifCommentLine
.create( "#!DATE " + df.format( new Date() ) ).toFormattedString( LdifFormatParameters.DEFAULT ) ); //$NON-NLS-1$
logWriter.write( errorCommentLine.toFormattedString( LdifFormatParameters.DEFAULT ) );
logWriter.write( record.toFormattedString( ldifFormatParameters ) );
}
catch ( IOException ioe )
{
monitor.reportError( BrowserCoreMessages.model__error_logging_modification, ioe );