嗨,我正在尝试在我的应用程序中实现java日志记录.我想使用两个处理程序.文件处理程序和我自己的控制台处理程序 我的两个处理程序都运行良好.我的日志记录将发送到文件和控制台.我的日志记录也被发送到我不想要的默认控制台处理程序.如果您运行我的代码,您将看到发送到控制台的额外两行.我不想使用默认的控制台处理程序.有谁知道如何禁用默认控制台处理程序.我只想使用我创建的两个处理程序.
Handler fh = new FileHandler("test.txt");
fh.setFormatter(formatter);
logger.addHandler(fh);
Run Code Online (Sandbox Code Playgroud)
Handler ch = new ConsoleHandler();
ch.setFormatter(formatter);
logger.addHandler(ch);
Run Code Online (Sandbox Code Playgroud)
import java.util.Date;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
public class LoggingExample {
private static Logger logger = Logger.getLogger("test");
static {
try {
logger.setLevel(Level.INFO);
Formatter formatter = new Formatter() {
@Override
public String format(LogRecord arg0) {
StringBuilder b = new StringBuilder();
b.append(new Date());
b.append(" ");
b.append(arg0.getSourceClassName());
b.append(" ");
b.append(arg0.getSourceMethodName());
b.append(" ");
b.append(arg0.getLevel());
b.append(" ");
b.append(arg0.getMessage()); …
Run Code Online (Sandbox Code Playgroud) 我使用WinINet库连接到一个网站.
使用Internet Explorer(Win10)它可以工作并向我显示选择要使用的证书的消息.
这是我调用的delphi代码:
FUNCTION TRAD.lastOrganization(): Integer;
VAR
js:TlkJSONobject;
ws: TlkJSONstring;
url, resp: String;
count,statusCodeLen, bodyCodeLen: Cardinal;
header,tmp: String;
buffer, body: String;
statusCode: ARRAY [0 .. 1024] OF Char;
bodyCode: ARRAY [0 .. 1024] OF Char;
UrlHandle: HINTERNET;
BEGIN
buffer := '00000000000000000000';
url := contextUrl + '/rest/organization/count';
UrlHandle := InternetOpenUrl(NetHandle, PChar(url), nil, 0, INTERNET_FLAG_RELOAD, 0);
IF NOT ASSIGNED(UrlHandle) THEN
SHOWMESSAGE('Unable to read the amount of Organization using the URL ' + url + ': ' + SysErrorMessage(GetLastError));
statusCodeLen := Length(statusCode); …
Run Code Online (Sandbox Code Playgroud) 该表的每一行Person
(有name
,firstname
和age
)应阅读.
EntityManager em = emf.createEntityManager();
Session s = (Session) em.getDelegate();
Criteria criteria = s.createCriteria(Person.class);
criteria.setFetchMode("age", FetchMode.SELECT);
Run Code Online (Sandbox Code Playgroud)
但SQL显示
Hibernate:
select
person0_.name,
person0_.firstname,
person0_.age
from
SCOPE.PERSON person0_
Run Code Online (Sandbox Code Playgroud)
如何让年龄懒惰只适用于标准?
Singleton无法自动装配SessionBean,但ScopedProxy可以.
假设100个用户在同一个应用程序中同时拥有一个有效的Session,ScopedProxy如何决定会话的含义?
我不认为ScopedProxy正在选择任何随机会话,这在我看来是无稽之谈.
NullPointerException
发生吗?我有两个应该相互排斥的接口:
interface Animal{}
interface Cat extends Animal{}
interface Bird extends Animal{}
Run Code Online (Sandbox Code Playgroud)
如何防止实现两者Cat
和Bird
接口的类的实现?
class Impossible implements Cat, Bird{}
Run Code Online (Sandbox Code Playgroud) 我有多个Tomcats和一个JBoss.
在JBoss中,我喜欢使用"JRMPProxyFactory"代理大约100个Tomcat的JMX-Beans.我有jboss中的所有接口,但我不知道我必须添加Tomcat的ip-addresses.
这是我的tomcat99-service.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
name="jboss.jmx:type=adaptor,name=Remote,protocol=jrmp,service=proxyFactory">
<depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
<depends optional-attribute-name="TargetName">tomcat99:service=JMX</depends>
<attribute name="JndiName">Tomcat99Target</attribute>
<attribute name="InvokeTargetMethod">true</attribute>
<attribute name="ExportedInterfaces">myinterface</attribute>
</mbean>
</server>
Run Code Online (Sandbox Code Playgroud) 我有两个Android设备,我没有Mac-Addresses的IP地址
d0:e7:82:fa:90:33 (a)
8c:bf:a6:a8:77:8f (b)
Run Code Online (Sandbox Code Playgroud)
如何从a发送一个字节到b?可能吗?
编辑:droped DatagramSocket-Sources因为它是基于打包的.
顺便提一下:设备不支持Wifi-Direct或蓝牙.
Maven管理的Eclipse插件包含以下配置:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>wonttellya</groupId>
<artifactId>wonttellya</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
...
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.10</version>
<configuration>
<pde>true</pde>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
在控制台我运行
C:\Users\user\git\wonttellya\mvn
eclipse:eclipse -Declipse.workspace=C:\Users\user\workspace2
...
Using Eclipse Workspace: C:\Users\user\workspace2
...
BUILD SUCCESS
Run Code Online (Sandbox Code Playgroud)
如果我在工作区中打开Eclipse,则没有项目.
假设我有这样的选择:
<select size="4">
<option id="1">Please wait ...</option>
<option id="2">Please wait ...</option>
<option id="3">Please wait ...</option>
<option id="4">Please wait ...</option>
<option id="5">Please wait ...</option>
</select>
Run Code Online (Sandbox Code Playgroud)
我应该看到一个包含右侧滚动条的4个元素的列表.
我现在要做的是如果选项以某种方式变得可见(滚动和/或初始化),则通过ajax加载文本.
最后,由于巨大的元数据传输,我不会加载它们.这是我必须上传的请求(发送到服务器):
这对于单个元素的延迟加载是不可接受的.
java ×8
eclipse ×2
lazy-loading ×2
android ×1
cryptoapi ×1
delphi ×1
eclipse-pde ×1
fetch ×1
hibernate ×1
ide ×1
jboss ×1
jmx ×1
jquery ×1
mac-address ×1
maven ×1
orm ×1
singleton ×1
spring ×1
tomcat ×1
visibility ×1