小编Vis*_*hnu的帖子

如何从管理控制台为应用程序配置WildFly 10日志记录子系统?

我想为我的应用程序使用Wildfly服务器的日志记录子系统.在一些在线博客的帮助下,我在standalone.xml中为我的应用程序添加了一个日志记录配置文件.

        <logging-profiles>
            <logging-profile name="myapp">
                <size-rotating-file-handler name="SIZE" autoflush="true">
                    <level name="ALL"/>
                    <file relative-to="jboss.server.log.dir" path="myapp.log"/>
                    <append value="true"/>
                </size-rotating-file-handler>
                <logger category="com.myapp.logs" use-parent-handlers="false">
                    <level name="ALL"/>
                    <handlers>
                        <handler name="SIZE"/>
                    </handlers>
                </logger>
                <root-logger>
                    <level name="INFO"/>
                    <handlers>
                        <handler name="SIZE"/>
                    </handlers>
                </root-logger>
            </logging-profile>
        </logging-profiles>
Run Code Online (Sandbox Code Playgroud)

我还在Manifest.mf中添加了记录器配置文件

Manifest-Version: 1.0
Class-Path:  
Logging-Profile: myapp
Run Code Online (Sandbox Code Playgroud)

现在应用程序日志记录工作正常,但我想知道是否可以从管理控制台本身进行配置.我尝试了很多次,但都失败了.此管理控制台中无法看到此日志记录配置文件.我在这做错什么吗?

注意:我希望将应用程序日志与服务器日志分开.

wildfly wildfly-10

5
推荐指数
1
解决办法
3598
查看次数

如何使用Google Cloud Python API将目录复制到Google Cloud Storage?

以下功能非常适合将单个文件复制到Google云存储。

#!/usr/bin/python3.5
import googleapiclient.discovery

from google.cloud import storage

def upload_blob(bucket_name, source_file_name, destination_blob_name, project):
  storage_client = storage.Client(project=project)
  bucket = storage_client.get_bucket(bucket_name)
  blob = bucket.blob(destination_blob_name)

blob.upload_from_filename(source_file_name)

print('File {} uploaded to {}.'.format(
    source_file_name,
    destination_blob_name))
Run Code Online (Sandbox Code Playgroud)

现在,我没有输入文件名,upload_blob('mybucket','/data/inputdata/', 'myapp/inputdata/','myapp') 而是尝试输入目录名称,但是随后出现此错误:

AttributeError:'str'对象没有属性'read'

调用函数blob.upload_from_file()以复制目录时是否需要提供任何其他参数?

python google-app-engine python-3.x google-cloud-storage google-cloud-platform

5
推荐指数
2
解决办法
1678
查看次数

如何使用FileWriter将文件写入Google数据平台?

我有一个java spark应用程序,需要收集spark作业的输出,然后保存到csv文件中.这是我的代码如下:

fileWriter = new FileWriter("gs://dataflow-exp1/google_storage_tests/20170524/outputfolder/Test.csv", true);
fileWriter.append("col1,col2,col3,col4");
Run Code Online (Sandbox Code Playgroud)

当我在谷歌数据proc中执行spark作业时,我得到文件未找到异常.我也有该文件夹的读/写权限.

java.io.FileNotFoundException: gs:/dataflow-exp1/google_storage_tests/20170524/outputfolder/Test.csv (No such file or directory)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
at java.io.FileWriter.<init>(FileWriter.java:78)
at com.src.main.MyApp.testWriteOutput(MyApp.java:72)
at com.src.main.MyApp.main(MyApp.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:736)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:185)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:210)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:124)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Run Code Online (Sandbox Code Playgroud)

看起来文件编写器在运行时使用单斜杠/而不是//后面的双斜杠gs:.我怎么解决这个问题?

我也开放其他方式而不是FileWriter写一个文件到谷歌数据proc.

java google-cloud-dataproc

4
推荐指数
1
解决办法
295
查看次数