如何在文本文件中写入日志但不覆盖文件?
Logger logger = Logger.getLogger("MyLog");
FileHandler fh = new FileHandler("C:/temp/test/MyLogFile.log");
logger.addHandler(fh);
...
logger.info("log sample");
答案 0 :(得分:3)
改变这个:
nbins = 2
bincount = 0
xpos = p2.x
ypos = p2.y
zpos = p2.z
xaxis = numpy.linspace(min(xpos), max(xpos), 2)
yaxis = numpy.linspace(min(ypos), max(ypos), 2)
zaxis = numpy.linspace(min(zpos), max(zpos), 2)
###initialize i,j,k???
for i in range(1, nbins):
for j in range(1, nbins):
for k in range(1, nbins):
findpoints = find(p2.x >= xaxis[i] & p2.x <= xaxis[i+1] & p2.y >= yaxis[j] & p2.y <= yaxis[j+1] & p2.z >= zaxis[k] & p2.z <= zaxis[k+1])
count = length(findpoints)
i = i+1
j = j+1
k = k+1
gridcount[i,j,k] = count
count = 0
total = sum(sum(sum(gridcount)))
gridP = gridcount/total
for i in irange(1, nbins):
xcenter = numpy.mean(xaxis[i],xaxis[i+1])
for j in jrange(1, nbins):
ycenter = numpy.mean(yaxis[j],yaxis[j+1])
for k in krange(1, nbins):
zcenter = numpy.mean(zaxis[k], zaxis[k+1])
r = gridP(i,j,k)
binsphere = sphere(radius = r, color = blue)
hold
axes3d.plot_surface(xcenter, ycenter, zcenter)
到这个
.currency {
text-align: right;
}
如果您阅读文档,您将看到第二个参数指定了可选的追加参数。如果为true,您将在(现有)文件的末尾写入,而不会覆盖它。