[SPARK-3377] [SPARK-3610] Metrics can be accidentally aggregated / History server log name should not be based on user input

This PR is another solution for #2250 

I'm using codahale base MetricsSystem of Spark with JMX or Graphite, and I saw following 2 problems.

(1) When applications which have same spark.app.name run on cluster at the same time, some metrics names are mixed. For instance, if 2+ application is running on the cluster at the same time, each application emits the same named metric like "SparkPi.DAGScheduler.stage.failedStages" and Graphite cannot distinguish the metrics is for which application.

(2) When 2+ executors run on the same machine, JVM metrics of each executors are mixed. For instance, 2+ executors running on the same node can emit the same named metric "jvm.memory" and Graphite cannot distinguish the metrics is from which application.

And there is an similar issue. The directory for event logs is named using application name.
Application name is defined by user and the name can includes illegal character for path names.
Further more, the directory name consists of application name and System.currentTimeMillis even though each application has unique Application ID so if we run jobs which have same name, it's difficult to identify which directory is for which application.

Closes #2250 
Closes #1067
It won't ever be null *in this code*. But it does not exist in application event logs that *have already been created* by the current stable release, and that the History Server needs to continue to be able to read and process correctly.

I'm just saying that in those cases Spark seems to generally use Option instead of null references. That's why I said that *in SparkListenerApplicationStart*, it might be better to leave it as `Option[String]` instead of having a potential null reference. But I'm ok with having the null reference too, as long as the History Server is fixed to handle that.