Examples of VoltLogger


Examples of org.voltcore.logging.VoltLogger

     * Create a file that starts with the supplied message that contains
     * human readable stack traces for all java threads in the current process.
     */
    public static void dropStackTrace(String message) {
        if (VoltDB.isThisATest()) {
            VoltLogger log = new VoltLogger("HOST");
            log.warn("Declining to drop a stack trace during a junit test.");
            return;
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd-HH:mm:ss.SSSZ");
        String dateString = sdf.format(new Date());
        CatalogContext catalogContext = VoltDB.instance().getCatalogContext();
        HostMessenger hm = VoltDB.instance().getHostMessenger();
        int hostId = 0;
        if (hm != null) {
            hostId = hm.getHostId();
        }
        String root = catalogContext != null ? catalogContext.cluster.getVoltroot() + File.separator : "";
        try {
            PrintWriter writer = new PrintWriter(root + "host" + hostId + "-" + dateString + ".txt");
            writer.println(message);
            printStackTraces(writer);
            writer.flush();
            writer.close();
        } catch (Exception e) {
            try
            {
                VoltLogger log = new VoltLogger("HOST");
                log.error("Error while dropping stack trace for \"" + message + "\"", e);
            }
            catch (RuntimeException rt_ex)
            {
                e.printStackTrace();
            }
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

        crashMessage = errMsg;
        if (ignoreCrash) {
            throw new AssertionError("Faux crash of VoltDB successful.");
        }
        if (VoltDB.isThisATest()) {
            VoltLogger log = new VoltLogger("HOST");
            log.warn("Declining to drop a crash file during a junit test.");
        }
        // end test code

        // try/finally block does its best to ensure death, no matter what context this
        // is called in
        try {
            // slightly less important than death, this try/finally block protects code that
            // prints a message to stdout
            try {

                // Even if the logger is null, don't stop.  We want to log the stack trace and
                // any other pertinent information to a .dmp file for crash diagnosis
                List<String> currentStacktrace = new ArrayList<String>();
                currentStacktrace.add("Stack trace from crashLocalVoltDB() method:");

                // Create a special dump file to hold the stack trace
                try
                {
                    TimestampType ts = new TimestampType(new java.util.Date());
                    CatalogContext catalogContext = VoltDB.instance().getCatalogContext();
                    String root = catalogContext != null ? catalogContext.cluster.getVoltroot() + File.separator : "";
                    PrintWriter writer = new PrintWriter(root + "voltdb_crash" + ts.toString().replace(' ', '-') + ".txt");
                    writer.println("Time: " + ts);
                    writer.println("Message: " + errMsg);

                    writer.println();
                    writer.println("Platform Properties:");
                    PlatformProperties pp = PlatformProperties.getPlatformProperties();
                    String[] lines = pp.toLogLines().split("\n");
                    for (String line : lines) {
                        writer.println(line.trim());
                    }

                    if (thrown != null) {
                        writer.println();
                        writer.println("****** Exception Thread ****** ");
                        thrown.printStackTrace(writer);
                    }

                    printStackTraces(writer, currentStacktrace);
                    writer.close();
                }
                catch (Throwable err)
                {
                    // shouldn't fail, but..
                    err.printStackTrace();
                }

                VoltLogger log = null;
                try
                {
                    log = new VoltLogger("HOST");
                }
                catch (RuntimeException rt_ex)
                { /* ignore */ }

                if (log != null)
                {
                    log.fatal(errMsg);
                    if (thrown != null) {
                        if (stackTrace) {
                            log.fatal("Fatal exception", thrown);
                        } else {
                            log.fatal(thrown.toString());
                        }
                    } else {
                        if (stackTrace) {
                            for (String currentStackElem : currentStacktrace) {
                                log.fatal(currentStackElem);
                            }
                        }
                    }
                } else {
                    System.err.println(errMsg);
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

public class TestRateLimitedLogger extends TestCase {

    @Test
    public void testRateLimit() {
        VoltLogger vlogger = Mockito.mock(VoltLogger.class);
        RateLimitedLogger logger = new RateLimitedLogger(20, vlogger, Level.DEBUG);

        long startTime = System.currentTimeMillis();
        while (true) {
            logger.log("foo", System.currentTimeMillis());
View Full Code Here

Examples of org.voltcore.logging.VoltLogger

            long sinceLastFAdvise = Long.MAX_VALUE;
            long positionAtLastFAdvise = 0;
            while (m_hasMoreChunks) {
                if (sinceLastFAdvise > 1024 * 1024 * 48) {
                    sinceLastFAdvise = 0;
                    VoltLogger log = new VoltLogger("SNAPSHOT");
                    try {
                        final long position = m_saveFile.position();
                        long retval = PosixAdvise.fadvise(
                                m_fd,
                                position,
                                position + 1024 * 1024 * 64,
                                PosixAdvise.POSIX_FADV_WILLNEED);
                        if (retval != 0) {
                            log.info("Failed to fadvise in TableSaveFile, this is harmless: " + retval);
                        }

                        //Get aligned start and end position
                        final long fadviseStart = positionAtLastFAdvise;
                        //-1 because we don't want to drop the last page because
                        //We will be reading it soon
                        positionAtLastFAdvise = ((position / Bits.pageSize()) - 1) * Bits.pageSize();
                        final long length = positionAtLastFAdvise - fadviseStart;
                        if (length > 0) {
                            retval = PosixAdvise.fadvise(
                                    m_fd,
                                    fadviseStart,
                                    length,
                                    PosixAdvise.POSIX_FADV_DONTNEED);
                        }
                        if (retval != 0) {
                            log.info("Failed to fadvise in TableSaveFile, this is harmless: " + retval);
                        }
                        positionAtLastFAdvise = position;
                    } catch (Throwable t) {
                        log.info("Exception attempting fadvise", t);
                    }
                }

                /*
                 * Limit the number of chunk materialized into memory at one time
View Full Code Here

Examples of org.voltdb.logging.VoltLogger

            int numPartitionsPerSite =   this.catalog_site.getPartitions().size();
            int numSites = this.catalogContext.numberOfSites;

            LOG.warn("ARIES : Log Native creation :: numSites : "+numSites+" numPartitionsPerSite : "+numPartitionsPerSite);          
            this.m_ariesLog = new AriesLogNative(numSites, numPartitionsPerSite, this.m_ariesLogFileName);
            this.m_recoveryLog = new VoltLogger("RECOVERY");
        }
                       
        // **IMPORTANT**
        // Always clear out the CatalogUtil and BatchPlanner before we start our new HStoreSite
        // TODO: Move this cache information into CatalogContext
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.