當前位置: 首頁>>代碼示例>>Java>>正文


Java Log類代碼示例

本文整理匯總了Java中org.eclipse.jetty.util.log.Log的典型用法代碼示例。如果您正苦於以下問題:Java Log類的具體用法?Java Log怎麽用?Java Log使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Log類屬於org.eclipse.jetty.util.log包,在下文中一共展示了Log類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
public @NotNull CollectorServer init(@NotNull InetSocketAddress address, @NotNull ExpositionFormat format) {
  try {
    Log.setLog(new Slf4jLog());

    final Server serverInstance = new Server(address);
    format.handler(serverInstance);
    serverInstance.start();

    server = serverInstance;

    Logger.instance.info("Prometheus server with JMX metrics started at " + address);
  } catch (Exception e) {
    Logger.instance.error("Failed to start server at " + address, e);
  }
  return this;
}
 
開發者ID:nolequen,項目名稱:jmx-prometheus-exporter,代碼行數:17,代碼來源:CollectorServer.java

示例2: setUpServer

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@Before
public void setUpServer() throws Exception {
    Awaitility.setDefaultPollDelay(2, TimeUnit.MILLISECONDS);
    Log.setLog(new NoLogging());

    impl = mock(TestService.Iface.class);
    instrumentation = mock(ServiceCallInstrumentation.class);

    provider = new DefaultSerializerProvider();

    server = new Server(0);
    ServletContextHandler handler = new ServletContextHandler();
    handler.addServlet(new ServletHolder(new ProvidenceServlet(new TestService.Processor(impl), provider, instrumentation)),
                       "/" + ENDPOINT);

    server.setHandler(handler);
    server.start();
    port = getExposedPort(server);
}
 
開發者ID:morimekta,項目名稱:providence,代碼行數:20,代碼來源:ProvidenceServletTest.java

示例3: setUpServer

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@BeforeClass
public static void setUpServer() throws Exception {
    Awaitility.setDefaultPollDelay(2, TimeUnit.MILLISECONDS);
    Log.setLog(new NoLogging());

    impl = mock(TestService.Iface.class);
    instrumentation = mock(ServiceCallInstrumentation.class);

    provider = new DefaultSerializerProvider();

    server = new Server(0);
    ServletContextHandler handler = new ServletContextHandler();
    handler.addServlet(new ServletHolder(new ProvidenceServlet(new TestService.Processor(impl), provider, instrumentation)),
                       "/" + ENDPOINT);

    server.setHandler(handler);
    server.start();
    port = getExposedPort(server);
}
 
開發者ID:morimekta,項目名稱:providence,代碼行數:20,代碼來源:ProvidenceServlet_ThriftClientTest.java

示例4: onRegister

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@Override
public void onRegister(CompileScope scope) {
    registerWrapperClass(scope, Session.class, PWebSocketSession.class);
    MemoryOperation.registerWrapper(WebSocketSession.class, PWebSocketSession.class);

    registerClass(scope, PHttpServer.class);
    registerClass(scope, PHttpServerRequest.class);
    registerClass(scope, PHttpServerResponse.class);
    registerClass(scope, PHttpAbstractHandler.class);
    registerClass(scope, PHttpRouteFilter.class);
    registerClass(scope, PHttpRouteHandler.class);
    registerClass(scope, PHttpRedirectHandler.class);
    registerClass(scope, PHttpDownloadFileHandler.class);
    registerClass(scope, PHttpResourceHandler.class);
    registerClass(scope, PHttpCORSFilter.class);
    registerClass(scope, PHttpGzipFilter.class);

    Log.setLog(new NoLogging());
}
 
開發者ID:jphp-compiler,項目名稱:jphp,代碼行數:20,代碼來源:HttpServerExtension.java

示例5: setup

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@Before
public void setup() throws IllegalAccessException {
	servletContext = Mockito.mock(ServletContext.class);
	servlet = new BackendProxyServlet() {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		{
			_log = Log.getLogger("junit");
		}

		@Override
		public ServletContext getServletContext() {
			return servletContext;
		}
	};

	FieldUtils.writeField(servlet, "_log", Mockito.mock(Logger.class), true);
	callback = Mockito.mock(Callback.class);
}
 
開發者ID:ligoj,項目名稱:bootstrap,代碼行數:23,代碼來源:BackendProxyServletTest.java

示例6: loadCases

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@TestFactory
@Override
public Stream<DynamicTest> loadCases(String param) throws IOException, URISyntaxException {
    return super.loadCases(param)
                .map(test -> DynamicTest.dynamicTest(test.getDisplayName(), () -> {
                    try {
                        ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
                        servletContextHandler.setContextPath("/");

                        // CXF Servlet
                        ServletHolder cxfServletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
                        cxfServletHolder.setInitParameter("jaxrs.serviceClasses", TestServerResource.class.getName());
                        servletContextHandler.addServlet(cxfServletHolder, "/*");


                        server = new Server(4442);
                        server.setHandler(servletContextHandler);
                        server.start();

                        Log.setLog(new StdErrLog());

                        test.getExecutable().execute();
                    } finally {
                        try {
                            server.stop();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }));
}
 
開發者ID:MegafonWebLab,項目名稱:histone-java2,代碼行數:32,代碼來源:HttpTranslatorTest.java

示例7: concreteTest

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@Test
public void concreteTest() throws Exception {

    HistoneTestCase.Case testCase = new HistoneTestCase.Case();
    testCase.setExpectedResult("true");
    testCase.setContext(getMap());
    testCase.setInput("{{var response = loadJSON('http://127.0.0.1:4442/', [headers: ['via': 123]])}}{{response -> isArray() && response.headers['via'] != '123'}}");
    try {
        ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
        servletContextHandler.setContextPath("/");

        // CXF Servlet
        ServletHolder cxfServletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
        cxfServletHolder.setInitParameter("jaxrs.serviceClasses", TestServerResource.class.getName());
        servletContextHandler.addServlet(cxfServletHolder, "/*");

        server = new Server(4442);
        server.setHandler(servletContextHandler);

        server.start();
        Log.setLog(new StdErrLog());

        new CoreTestConsumer(parser, rtti, evaluator).accept(testCase);
    } finally {
        try {
            server.stop();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:MegafonWebLab,項目名稱:histone-java2,代碼行數:32,代碼來源:HttpConcreteTest.java

示例8: initializeJettyLogging

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
private static void initializeJettyLogging() {
    // Note: Jetty is logging stderr if no logger is explicitly configured.
    try {
        Log.setLog(new JavaUtilLog());
    } catch (Exception e) {
        throw new RuntimeException("Unable to initialize logging framework for Jetty");
    }
}
 
開發者ID:vespa-engine,項目名稱:vespa,代碼行數:9,代碼來源:JettyHttpServer.java

示例9: getPassword

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
/**
 * Get a password. A password is obtained by trying
 * <UL>
 * <LI>Calling <Code>System.getProperty(realm,dft)</Code>
 * <LI>Prompting for a password
 * <LI>Using promptDft if nothing was entered.
 * </UL>
 * 
 * @param realm The realm name for the password, used as a SystemProperty
 *                name.
 * @param dft The default password.
 * @param promptDft The default to use if prompting for the password.
 * @return Password
 */
public static Password getPassword(String realm, String dft, String promptDft)
{
    String passwd = System.getProperty(realm, dft);
    if (passwd == null || passwd.length() == 0)
    {
        try
        {
            System.out.print(realm + ((promptDft != null && promptDft.length() > 0) ? " [dft]" : "") + " : ");
            System.out.flush();
            byte[] buf = new byte[512];
            int len = System.in.read(buf);
            if (len > 0) passwd = new String(buf, 0, len).trim();
        }
        catch (IOException e)
        {
            LOG.warn(Log.EXCEPTION, e);
        }
        if (passwd == null || passwd.length() == 0) passwd = promptDft;
    }
    return new Password(passwd);
}
 
開發者ID:itead,項目名稱:IoTgo_Android_App,代碼行數:36,代碼來源:Password.java

示例10: setUp

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
    Log.setLog(new NoLogging());

    rc = copyResourceTo("/pvdrc", temp.getRoot());
    copyResourceTo("/test.thrift", temp.getRoot());

    impl = Mockito.mock(MyService.Iface.class);

    TServerSocket transport = new TServerSocket(0);
    server = new TSimpleServer(
            new TServer.Args(transport)
                    .protocolFactory(new TBinaryProtocol.Factory())
                    .processor(new MyService.Processor<>(impl)));
    ExecutorService executor = Executors.newSingleThreadExecutor();
    executor.submit(server::serve);
    Thread.sleep(1);
    port = transport.getServerSocket().getLocalPort();

    exitCode = 0;
    rpc = new RPC(console.tty()) {
        @Override
        protected void exit(int i) {
            exitCode = i;
        }
    };
}
 
開發者ID:morimekta,項目名稱:providence,代碼行數:28,代碼來源:RPCThriftSocketTest.java

示例11: setUp

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
    Log.setLog(new NoLogging());

    rc = copyResourceTo("/pvdrc", temp.getRoot());
    copyResourceTo("/test.thrift", temp.getRoot());

    impl = mock(MyService.Iface.class);

    server = new Server(0);
    DefaultSerializerProvider provider = new DefaultSerializerProvider();

    ServletContextHandler handler = new ServletContextHandler();
    handler.addServlet(new ServletHolder(new ProvidenceServlet(new MyService.Processor(impl), provider)),
                       "/" + ENDPOINT);

    server.setHandler(handler);
    server.start();
    port = getExposedPort(server);
    Thread.sleep(1);

    exitCode = 0;
    rpc = new RPC(console.tty()) {
        @Override
        protected void exit(int i) {
            exitCode = i;
        }
    };
}
 
開發者ID:morimekta,項目名稱:providence,代碼行數:30,代碼來源:RPCProvidenceHttpTest.java

示例12: initialize

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
public void initialize() {
    Log.setLog(new JettyLogger());

    // configure the web service.
    Spark.port(2000);
    DefaultWebServiceFilters.apply(OpenHabboRoomService.getInstance().getServiceConfiguration());

    this.applyRoutes();
}
 
開發者ID:LeonHartley,項目名稱:OpenHabbo,代碼行數:10,代碼來源:RoomWebService.java

示例13: createRequest

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
protected HttpUriRequest createRequest() throws URISyntaxException {
	URIBuilder uriBuilder = new URIBuilder()
		.setScheme("http")
		.setHost("localhost").setPort(9031)
		.setPath("/");
		
	URI uri = uriBuilder.build();
	Log.info("Getting URL="+uri);
	HttpUriRequest httpUriRequest = new HttpGet(uri);
	Log.info("Got URL="+uri);
	return httpUriRequest;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:13,代碼來源:OWLServerMetadataTest.java

示例14: fetch

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@GET
public Response fetch() {
    File file = new File(cameraDevice.getConfig().getFilePath());
    if (file.exists()) {
        try {
            java.nio.file.Path path = Paths.get(file.getAbsolutePath());
            byte[] imageData = Files.readAllBytes(path);

            return Response.ok(new ByteArrayInputStream(imageData)).build();
        } catch (Exception e) {
            Log.getLog().info("Exception: " + e.getMessage(), e);
        }
    }

    // uncomment line below to send non-streamed
    return Response.status(Response.Status.NOT_FOUND).build();

}
 
開發者ID:ludwigandersson,項目名稱:thermospy,代碼行數:19,代碼來源:GetLastImage.java

示例15: resetAndFetch

import org.eclipse.jetty.util.log.Log; //導入依賴的package包/類
@GET
@Path("/reset-and-fetch")
public Response resetAndFetch()
{
    // Stop service if running
    if (controller.getServiceStatus())
    {
        controller.stop();
    }
    
    controller.setDisplayBoundary(new Boundary());
    controller.singleshot();
    
    if (controller.getServerStatus() == ServerStatus.OK) {
        return fetch();
    } else {
        Log.getLog().warn("Cannot fetch last image because an internal server error occured!");
        return Response.serverError().build();
    }
    
}
 
開發者ID:ludwigandersson,項目名稱:thermospy,代碼行數:22,代碼來源:GetLastImage.java


注:本文中的org.eclipse.jetty.util.log.Log類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。