mirror of https://github.com/apache/cloudstack.git
Fix build errors due to log4j 2.x changes
This commit is contained in:
parent
7b57480d60
commit
bf9fdaddbd
|
|
@ -16,8 +16,6 @@
|
||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.upgrade.dao;
|
package com.cloud.upgrade.dao;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import com.cloud.upgrade.SystemVmTemplateRegistration;
|
import com.cloud.upgrade.SystemVmTemplateRegistration;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import com.cloud.utils.DateUtil;
|
||||||
import com.cloud.utils.db.GenericDaoBase;
|
import com.cloud.utils.db.GenericDaoBase;
|
||||||
import com.cloud.utils.db.SearchCriteria;
|
import com.cloud.utils.db.SearchCriteria;
|
||||||
import com.cloud.utils.db.TransactionLegacy;
|
import com.cloud.utils.db.TransactionLegacy;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
|
@ -34,7 +33,6 @@ import java.util.TimeZone;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class UsageVpcDaoImpl extends GenericDaoBase<UsageVpcVO, Long> implements UsageVpcDao {
|
public class UsageVpcDaoImpl extends GenericDaoBase<UsageVpcVO, Long> implements UsageVpcDao {
|
||||||
private static final Logger LOGGER = Logger.getLogger(UsageVpcDaoImpl.class);
|
|
||||||
protected static final String GET_USAGE_RECORDS_BY_ACCOUNT = "SELECT id, vpc_id, zone_id, account_id, domain_id, state, created, removed FROM usage_vpc WHERE " +
|
protected static final String GET_USAGE_RECORDS_BY_ACCOUNT = "SELECT id, vpc_id, zone_id, account_id, domain_id, state, created, removed FROM usage_vpc WHERE " +
|
||||||
" account_id = ? AND ((removed IS NULL AND created <= ?) OR (created BETWEEN ? AND ?) OR (removed BETWEEN ? AND ?) " +
|
" account_id = ? AND ((removed IS NULL AND created <= ?) OR (created BETWEEN ? AND ?) OR (removed BETWEEN ? AND ?) " +
|
||||||
" OR ((created <= ?) AND (removed >= ?)))";
|
" OR ((created <= ?) AND (removed >= ?)))";
|
||||||
|
|
@ -52,7 +50,7 @@ public class UsageVpcDaoImpl extends GenericDaoBase<UsageVpcVO, Long> implements
|
||||||
update(vo.getId(), vo);
|
update(vo.getId(), vo);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
LOGGER.error(String.format("Error updating usage of VPC due to [%s].", e.getMessage()), e);
|
logger.error(String.format("Error updating usage of VPC due to [%s].", e.getMessage()), e);
|
||||||
txn.rollback();
|
txn.rollback();
|
||||||
} finally {
|
} finally {
|
||||||
txn.close();
|
txn.close();
|
||||||
|
|
@ -74,7 +72,7 @@ public class UsageVpcDaoImpl extends GenericDaoBase<UsageVpcVO, Long> implements
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
txn.rollback();
|
txn.rollback();
|
||||||
LOGGER.error(String.format("Error updating usage of VPC due to [%s].", e.getMessage()), e);
|
logger.error(String.format("Error updating usage of VPC due to [%s].", e.getMessage()), e);
|
||||||
} finally {
|
} finally {
|
||||||
txn.close();
|
txn.close();
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +119,7 @@ public class UsageVpcDaoImpl extends GenericDaoBase<UsageVpcVO, Long> implements
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
txn.rollback();
|
txn.rollback();
|
||||||
LOGGER.warn("Error getting VPC usage records", e);
|
logger.warn("Error getting VPC usage records", e);
|
||||||
} finally {
|
} finally {
|
||||||
txn.close();
|
txn.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1045,7 +1045,7 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||||
}
|
}
|
||||||
parsed = VpcUsageParser.parse(account, currentStartDate, currentEndDate);
|
parsed = VpcUsageParser.parse(account, currentStartDate, currentEndDate);
|
||||||
if (!parsed) {
|
if (!parsed) {
|
||||||
s_logger.debug(String.format("VPC usage failed to parse for account [%s].", account));
|
logger.debug(String.format("VPC usage failed to parse for account [%s].", account));
|
||||||
}
|
}
|
||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
|
|
@ -2140,7 +2140,7 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
||||||
UsageVpcVO usageVPCVO = new UsageVpcVO(event.getResourceId(), event.getZoneId(), event.getAccountId(), domainId, Vpc.State.Enabled.name(), event.getCreateDate(), null);
|
UsageVpcVO usageVPCVO = new UsageVpcVO(event.getResourceId(), event.getZoneId(), event.getAccountId(), domainId, Vpc.State.Enabled.name(), event.getCreateDate(), null);
|
||||||
usageVpcDao.persist(usageVPCVO);
|
usageVpcDao.persist(usageVPCVO);
|
||||||
} else {
|
} else {
|
||||||
s_logger.error(String.format("Unknown event type [%s] in VPC event parser. Skipping it.", event.getType()));
|
logger.error(String.format("Unknown event type [%s] in VPC event parser. Skipping it.", event.getType()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,17 @@ import com.cloud.user.AccountVO;
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.apache.cloudstack.usage.UsageTypes;
|
import org.apache.cloudstack.usage.UsageTypes;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class VpcUsageParser {
|
public class VpcUsageParser {
|
||||||
private static final Logger LOGGER = Logger.getLogger(VpcUsageParser.class.getName());
|
private static final Logger LOGGER = LogManager.getLogger(VpcUsageParser.class.getName());
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private UsageVpcDao vpcDao;
|
private UsageVpcDao vpcDao;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue