Examples of LogWriter


Examples of org.apache.derby.client.am.LogWriter

        if (printWriter == null) {
            return null;
        }

        LogWriter dncLogWriter =
            connection.agent_.newLogWriter_(printWriter, traceLevel);

        if (printWriter != logWriter &&
                (traceDirectory != null || traceFile != null))
        // When printWriter is an internal trace file and
View Full Code Here

Examples of org.apache.derby.client.am.LogWriter

     * @return a Connection to the database
     *
     * @throws java.sql.SQLException if a database-access error occurs.
     */
    public java.sql.Connection getConnection() throws SQLException {
        LogWriter dncLogWriter = null;
        try {
            updateDataSourceValues(
                    tokenizeAttributes(getConnectionAttributes(), null));
            dncLogWriter = computeDncLogWriterForNewConnection("_sds");
            return getConnectionX(dncLogWriter, getUser(), getPassword());
View Full Code Here

Examples of org.apache.derby.client.am.LogWriter

        // Jdbc 2 connections will write driver trace info on a
        // datasource-wide basis using the jdbc 2 data source log writer.
        // This log writer may be narrowed to the connection-level
        // This log writer will be passed to the agent constructor.

        LogWriter dncLogWriter = null;
        try
        {
            updateDataSourceValues(
                    tokenizeAttributes(getConnectionAttributes(), null));
            dncLogWriter = computeDncLogWriterForNewConnection("_sds");
View Full Code Here

Examples of org.apache.derby.client.am.LogWriter

    }


    protected final PooledConnection getPooledConnectionMinion()
            throws SQLException {
        LogWriter dncLogWriter = null;

        try {
            updateDataSourceValues(
                    tokenizeAttributes(getConnectionAttributes(), null));
            dncLogWriter = computeDncLogWriterForNewConnection("_cpds");

            if (dncLogWriter != null) {
                dncLogWriter.traceEntry(this, "getPooledConnection");
            }

            PooledConnection pooledConnection = getPooledConnectionX(
                    dncLogWriter, this, getUser(), getPassword());

            if (dncLogWriter != null) {
                dncLogWriter.traceExit(
                        this, "getPooledConnection", pooledConnection);
            }

            return pooledConnection;
        }
View Full Code Here

Examples of org.apache.derby.client.am.LogWriter

    }

    protected final PooledConnection getPooledConnectionMinion(
            String user, String password) throws SQLException {

        LogWriter dncLogWriter = null;

        try {
            updateDataSourceValues(
                    tokenizeAttributes(getConnectionAttributes(), null));
            dncLogWriter = computeDncLogWriterForNewConnection("_cpds");

            if (dncLogWriter != null) {
                dncLogWriter.traceEntry(
                        this, "getPooledConnection", user, "<escaped>");
            }

            PooledConnection pooledConnection = getPooledConnectionX(
                    dncLogWriter, this, user, password);

            if (dncLogWriter != null) {
                dncLogWriter.traceExit(
                        this, "getPooledConnection", pooledConnection);
            }

            return pooledConnection;
View Full Code Here

Examples of org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogWriter

    FileOutputStream os = new FileOutputStream(outputFile);
    final OutputStreamWriter osw = new OutputStreamWriter(os, "UTF8");
    final int ch = filler;

    UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
    LogWriter logWriter = new LogWriter(conf, remoteAppLogFile, ugi);

    LogKey logKey = new LogKey(testContainerId);
    LogValue logValue =
        spy(new LogValue(Collections.singletonList(srcFileRoot.toString()),
            testContainerId, ugi.getShortUserName()));

    final CountDownLatch latch = new CountDownLatch(1);

    Thread t = new Thread() {
      public void run() {
        try {
          for(int i=0; i < length/3; i++) {
              osw.write(ch);
          }

          latch.countDown();

          for(int i=0; i < (2*length)/3; i++) {
            osw.write(ch);
          }
          osw.close();
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    };
    t.start();

    //Wait till the osw is partially written
    //aggregation starts once the ows has completed 1/3rd of its work
    latch.await();

    //Aggregate The Logs
    logWriter.append(logKey, logValue);
    logWriter.close();
  }
View Full Code Here

Examples of org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogWriter

    int numChars = 80000;

    writeSrcFile(srcFilePath, "stdout", numChars);

    UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
    LogWriter logWriter = new LogWriter(conf, remoteAppLogFile, ugi);

    LogKey logKey = new LogKey(testContainerId);
    LogValue logValue =
        new LogValue(Collections.singletonList(srcFileRoot.toString()),
            testContainerId, ugi.getShortUserName());

    logWriter.append(logKey, logValue);
    logWriter.close();

    // make sure permission are correct on the file
    FileStatus fsStatus =  fs.getFileStatus(remoteAppLogFile);
    Assert.assertEquals("permissions on log aggregation file are wrong"
      FsPermission.createImmutable((short) 0640), fsStatus.getPermission());
View Full Code Here

Examples of org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogWriter

    writeSrcFile(srcFilePath1, stderr, data + testContainerId1.toString()
        + stderr);

    UserGroupInformation ugi =
        UserGroupInformation.getCurrentUser();
    LogWriter logWriter = new LogWriter(conf, remoteAppLogFile, ugi);

    LogKey logKey = new LogKey(testContainerId1);
    String randomUser = "randomUser";
    LogValue logValue =
        spy(new LogValue(Collections.singletonList(srcFileRoot.toString()),
            testContainerId1, randomUser));
   
    // It is trying simulate a situation where first log file is owned by
    // different user (probably symlink) and second one by the user itself.
    when(logValue.getUser()).thenReturn(randomUser).thenReturn(
        ugi.getShortUserName());
    logWriter.append(logKey, logValue);

    logWriter.close();
   
    BufferedReader in =
        new BufferedReader(new FileReader(new File(remoteAppLogFile
            .toUri().getRawPath())));
    String line;
View Full Code Here

Examples of org.apache.hadoop.yarn.server.nodemanager.containermanager.logaggregation.AggregatedLogFormat.LogWriter

    if (this.writer == null) {
      LOG.info("Starting aggregate log-file for app " + this.applicationId
          + " at " + this.remoteNodeTmpLogFileForApp);
      try {
        this.writer =
            new LogWriter(this.conf, this.remoteNodeTmpLogFileForApp,
                this.userUgi);
        //Write ACLs once when and if the writer is created.
        this.writer.writeApplicationACLs(appAcls);
        this.writer.writeApplicationOwner(this.userUgi.getShortUserName());
      } catch (IOException e) {
View Full Code Here

Examples of org.apache.sling.scripting.core.impl.LogWriter

public class LogWriterTest extends TestCase {

    public void testCharacter() {
        MockLogger logger = new MockLogger();
        LogWriter logWriter = new LogWriter(logger);

        // ensure logger is empty
        logger.getLastMessage();

        // empty flush
        logWriter.flush();
        String msg = logger.getLastMessage();
        assertNull(msg);

        // write a single character, message only after flush
        logWriter.write('a');
        assertNull(logger.getLastMessage());
        logWriter.flush();
        msg = logger.getLastMessage();
        assertNotNull(msg);
        assertEquals("a", msg);

        // write a single CR, no message
        logWriter.write('\r');
        assertNull(logger.getLastMessage());

        // write a single LF, no message
        logWriter.write('\n');
        assertNull(logger.getLastMessage());

        // write three characters (one is CR)
        logWriter.write('a');
        logWriter.write('\r');
        logWriter.write('b');

        msg = logger.getLastMessage();
        assertNotNull(msg);
        assertEquals("a", msg);

        logWriter.flush();

        msg = logger.getLastMessage();
        assertNotNull(msg);
        assertEquals("b", msg);

        // write three characters (one is LF)
        logWriter.write('a');
        logWriter.write('\n');
        logWriter.write('b');

        msg = logger.getLastMessage();
        assertNotNull(msg);
        assertEquals("a", msg);

        logWriter.flush();

        msg = logger.getLastMessage();
        assertNotNull(msg);
        assertEquals("b", msg);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.