누구나 Apache Commons Logger를 설치하는 방법을 알고 있습니까? people got it running처럼 보이지만 나는 비참하게 실패하고 있습니다.Apache Commons Logger를 설정하는 방법
내 현재 설정은 매우 간단합니다 :
이build.gradle :
compile('commons-logging:commons-logging:1.2')
j2objcTranslation 'commons-logging:commons-logging:1.2'
로거 초기화 :
private static Log logger = LogFactory.getLog(ApiService.class);
도 매우 간단 logging.properties
파일이이 첨부 할 수 있습니다 필요한 경우.
2016-09-21 19:39:35.960 temple8-ios[32544:598370] Fucking logger
2016-09-21 19:39:36.048 temple8-ios[32544:598370] *** Terminating app due to uncaught exception 'OrgApacheCommonsLoggingLogConfigurationException', reason: 'java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl (Caused by java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl)'
*** First throw call stack:
(
0 CoreFoundation 0x000000010e471d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010d40cdeb objc_exception_throw + 48
2 temple8-ios 0x000000010c056a27 OrgApacheCommonsLoggingLogFactory_newFactoryWithNSString_withJavaLangClassLoader_withJavaLangClassLoader_ + 327
3 temple8-ios 0x000000010c059d06 OrgApacheCommonsLoggingLogFactory_getFactory + 3030
4 temple8-ios 0x000000010c056026 OrgApacheCommonsLoggingLogFactory_getLogWithIOSClass_ + 70
편집 한
@tball이 his answer에 어떤 좋은 정보를 제공하지만, 새로운 문제에 그 리드 : 번역 및 iOS 에뮬레이터에 다음과 같은 예외를 실행 한 후
가 발생합니다. LogFactoryImpl
에 대한 정적 참조를 추가했으며 프로젝트에 java.util.logging.IOSLogHandler
을 포함 시켰습니다. 그 클래스를 번역하려고 할 때 컴파일러는 다음과 같은 오류가 발생합니다 : 나는 j2objC github repository에서 IOSLogHandler
의 최신 버전을 사용하고 있는데 gist에 생성 된 IOSLogHandler.m
을 게시 한
/java/util/logging/IOSLogHandler.m:58:17: error: method definition for 'IOS_LOG_MANAGER_DEFAULTS' not found [-Werror,-Wincomplete-implementation]
@implementation JavaUtilLoggingIOSLogHandler
^
java/util/logging/IOSLogHandler.h:34:1: note: method 'IOS_LOG_MANAGER_DEFAULTS' declared here
+ (NSString *)IOS_LOG_MANAGER_DEFAULTS;
^
1 error generated.
.
많은 도움을 주셔서 감사합니다.
IOSLogHandler는 apache-commons-logging이 아닌 java.util.logging을 지원합니다. apache-commons-logging에 필요한 것은 LogFactoryImpl 클래스 참조입니다. 따라서 프로젝트에 IOSLogHandler를 추가하기 위해 수행 한 모든 단계를 취소하십시오. – tball